refactor: move brother_node development artifact to dev/test-nodes subdirectory
Development Artifact Cleanup: ✅ BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location - dev/test-nodes/brother_node/: Moved from root directory for better organization - Contains development configuration, test logs, and test chain data - No impact on production systems - purely development/testing artifact ✅ DEVELOPMENT ARTIFACTS IDENTIFIED: - Chain ID: aitbc-brother-chain (test/development chain) - Ports: 8010 (P2P) and 8011 (RPC) - different from production - Environment: .env file with test configuration - Logs: rpc.log and node.log from development testing session (March 15, 2026) ✅ ROOT DIRECTORY CLEANUP: Removed development clutter from production directory - brother_node/ moved to dev/test-nodes/brother_node/ - Root directory now contains only production-ready components - Development artifacts properly organized in dev/ subdirectory DIRECTORY STRUCTURE IMPROVEMENT: 📁 dev/test-nodes/: Development and testing node configurations 🏗️ Root Directory: Clean production structure with only essential components 🧪 Development Isolation: Test environments separated from production BENEFITS: ✅ Clean Production Directory: No development artifacts in root ✅ Better Organization: Development nodes grouped in dev/ subdirectory ✅ Clear Separation: Production vs development environments clearly distinguished ✅ Maintainability: Easier to identify and manage development components RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
This commit is contained in:
21
dev/env/node_modules/@sentry/core/LICENSE
generated
vendored
Executable file
21
dev/env/node_modules/@sentry/core/LICENSE
generated
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 Functional Software, Inc. dba Sentry
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
22
dev/env/node_modules/@sentry/core/README.md
generated
vendored
Executable file
22
dev/env/node_modules/@sentry/core/README.md
generated
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
<p align="center">
|
||||
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
|
||||
<img src="https://sentry-brand.storage.googleapis.com/sentry-wordmark-dark-280x84.png" alt="Sentry" width="280" height="84">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# Sentry JavaScript SDK Core
|
||||
|
||||
[](https://www.npmjs.com/package/@sentry/core)
|
||||
[](https://www.npmjs.com/package/@sentry/core)
|
||||
[](https://www.npmjs.com/package/@sentry/core)
|
||||
|
||||
## Links
|
||||
|
||||
- [Official SDK Docs](https://docs.sentry.io/quickstart/)
|
||||
|
||||
## General
|
||||
|
||||
This package contains interface definitions, base classes and utilities for building Sentry JavaScript SDKs, like
|
||||
`@sentry/node` or `@sentry/browser`.
|
||||
|
||||
Please consider all classes and exported functions and interfaces `internal`.
|
||||
87
dev/env/node_modules/@sentry/core/build/cjs/api.js
generated
vendored
Executable file
87
dev/env/node_modules/@sentry/core/build/cjs/api.js
generated
vendored
Executable file
@@ -0,0 +1,87 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const dsn = require('./utils/dsn.js');
|
||||
|
||||
const SENTRY_API_VERSION = '7';
|
||||
|
||||
/** Returns the prefix to construct Sentry ingestion API endpoints. */
|
||||
function getBaseApiEndpoint(dsn) {
|
||||
const protocol = dsn.protocol ? `${dsn.protocol}:` : '';
|
||||
const port = dsn.port ? `:${dsn.port}` : '';
|
||||
return `${protocol}//${dsn.host}${port}${dsn.path ? `/${dsn.path}` : ''}/api/`;
|
||||
}
|
||||
|
||||
/** Returns the ingest API endpoint for target. */
|
||||
function _getIngestEndpoint(dsn) {
|
||||
return `${getBaseApiEndpoint(dsn)}${dsn.projectId}/envelope/`;
|
||||
}
|
||||
|
||||
/** Returns a URL-encoded string with auth config suitable for a query string. */
|
||||
function _encodedAuth(dsn, sdkInfo) {
|
||||
const params = {
|
||||
sentry_version: SENTRY_API_VERSION,
|
||||
};
|
||||
|
||||
if (dsn.publicKey) {
|
||||
// We send only the minimum set of required information. See
|
||||
// https://github.com/getsentry/sentry-javascript/issues/2572.
|
||||
params.sentry_key = dsn.publicKey;
|
||||
}
|
||||
|
||||
if (sdkInfo) {
|
||||
params.sentry_client = `${sdkInfo.name}/${sdkInfo.version}`;
|
||||
}
|
||||
|
||||
return new URLSearchParams(params).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the envelope endpoint URL with auth in the query string.
|
||||
*
|
||||
* Sending auth as part of the query string and not as custom HTTP headers avoids CORS preflight requests.
|
||||
*/
|
||||
function getEnvelopeEndpointWithUrlEncodedAuth(dsn, tunnel, sdkInfo) {
|
||||
return tunnel ? tunnel : `${_getIngestEndpoint(dsn)}?${_encodedAuth(dsn, sdkInfo)}`;
|
||||
}
|
||||
|
||||
/** Returns the url to the report dialog endpoint. */
|
||||
function getReportDialogEndpoint(dsnLike, dialogOptions) {
|
||||
const dsn$1 = dsn.makeDsn(dsnLike);
|
||||
if (!dsn$1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const endpoint = `${getBaseApiEndpoint(dsn$1)}embed/error-page/`;
|
||||
|
||||
let encodedOptions = `dsn=${dsn.dsnToString(dsn$1)}`;
|
||||
for (const key in dialogOptions) {
|
||||
if (key === 'dsn') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key === 'onClose') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (key === 'user') {
|
||||
const user = dialogOptions.user;
|
||||
if (!user) {
|
||||
continue;
|
||||
}
|
||||
if (user.name) {
|
||||
encodedOptions += `&name=${encodeURIComponent(user.name)}`;
|
||||
}
|
||||
if (user.email) {
|
||||
encodedOptions += `&email=${encodeURIComponent(user.email)}`;
|
||||
}
|
||||
} else {
|
||||
encodedOptions += `&${encodeURIComponent(key)}=${encodeURIComponent(dialogOptions[key] )}`;
|
||||
}
|
||||
}
|
||||
|
||||
return `${endpoint}?${encodedOptions}`;
|
||||
}
|
||||
|
||||
exports.getEnvelopeEndpointWithUrlEncodedAuth = getEnvelopeEndpointWithUrlEncodedAuth;
|
||||
exports.getReportDialogEndpoint = getReportDialogEndpoint;
|
||||
//# sourceMappingURL=api.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/api.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/api.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
35
dev/env/node_modules/@sentry/core/build/cjs/asyncContext/index.js
generated
vendored
Executable file
35
dev/env/node_modules/@sentry/core/build/cjs/asyncContext/index.js
generated
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const carrier = require('../carrier.js');
|
||||
const stackStrategy = require('./stackStrategy.js');
|
||||
|
||||
/**
|
||||
* @private Private API with no semver guarantees!
|
||||
*
|
||||
* Sets the global async context strategy
|
||||
*/
|
||||
function setAsyncContextStrategy(strategy) {
|
||||
// Get main carrier (global for every environment)
|
||||
const registry = carrier.getMainCarrier();
|
||||
const sentry = carrier.getSentryCarrier(registry);
|
||||
sentry.acs = strategy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current async context strategy.
|
||||
* If none has been setup, the default will be used.
|
||||
*/
|
||||
function getAsyncContextStrategy(carrier$1) {
|
||||
const sentry = carrier.getSentryCarrier(carrier$1);
|
||||
|
||||
if (sentry.acs) {
|
||||
return sentry.acs;
|
||||
}
|
||||
|
||||
// Otherwise, use the default one (stack)
|
||||
return stackStrategy.getStackAsyncContextStrategy();
|
||||
}
|
||||
|
||||
exports.getAsyncContextStrategy = getAsyncContextStrategy;
|
||||
exports.setAsyncContextStrategy = setAsyncContextStrategy;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/asyncContext/index.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/asyncContext/index.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../src/asyncContext/index.ts"],"sourcesContent":["import type { Carrier } from './../carrier';\nimport { getMainCarrier, getSentryCarrier } from './../carrier';\nimport { getStackAsyncContextStrategy } from './stackStrategy';\nimport type { AsyncContextStrategy } from './types';\n\n/**\n * @private Private API with no semver guarantees!\n *\n * Sets the global async context strategy\n */\nexport function setAsyncContextStrategy(strategy: AsyncContextStrategy | undefined): void {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n const sentry = getSentryCarrier(registry);\n sentry.acs = strategy;\n}\n\n/**\n * Get the current async context strategy.\n * If none has been setup, the default will be used.\n */\nexport function getAsyncContextStrategy(carrier: Carrier): AsyncContextStrategy {\n const sentry = getSentryCarrier(carrier);\n\n if (sentry.acs) {\n return sentry.acs;\n }\n\n // Otherwise, use the default one (stack)\n return getStackAsyncContextStrategy();\n}\n"],"names":["getMainCarrier","getSentryCarrier","carrier","getStackAsyncContextStrategy"],"mappings":";;;;;AAKA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,QAAQ,EAA0C;AAC1F;AACA,EAAE,MAAM,QAAA,GAAWA,sBAAc,EAAE;AACnC,EAAE,MAAM,MAAA,GAASC,wBAAgB,CAAC,QAAQ,CAAC;AAC3C,EAAE,MAAM,CAAC,GAAA,GAAM,QAAQ;AACvB;;AAEA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAACC,SAAO,EAAiC;AAChF,EAAE,MAAM,MAAA,GAASD,wBAAgB,CAACC,SAAO,CAAC;;AAE1C,EAAE,IAAI,MAAM,CAAC,GAAG,EAAE;AAClB,IAAI,OAAO,MAAM,CAAC,GAAG;AACrB;;AAEA;AACA,EAAE,OAAOC,0CAA4B,EAAE;AACvC;;;;;"}
|
||||
162
dev/env/node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js
generated
vendored
Executable file
162
dev/env/node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js
generated
vendored
Executable file
@@ -0,0 +1,162 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const defaultScopes = require('../defaultScopes.js');
|
||||
const scope = require('../scope.js');
|
||||
const is = require('../utils/is.js');
|
||||
const carrier = require('../carrier.js');
|
||||
|
||||
/**
|
||||
* This is an object that holds a stack of scopes.
|
||||
*/
|
||||
class AsyncContextStack {
|
||||
|
||||
constructor(scope$1, isolationScope) {
|
||||
let assignedScope;
|
||||
if (!scope$1) {
|
||||
assignedScope = new scope.Scope();
|
||||
} else {
|
||||
assignedScope = scope$1;
|
||||
}
|
||||
|
||||
let assignedIsolationScope;
|
||||
if (!isolationScope) {
|
||||
assignedIsolationScope = new scope.Scope();
|
||||
} else {
|
||||
assignedIsolationScope = isolationScope;
|
||||
}
|
||||
|
||||
// scope stack for domains or the process
|
||||
this._stack = [{ scope: assignedScope }];
|
||||
this._isolationScope = assignedIsolationScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fork a scope for the stack.
|
||||
*/
|
||||
withScope(callback) {
|
||||
const scope = this._pushScope();
|
||||
|
||||
let maybePromiseResult;
|
||||
try {
|
||||
maybePromiseResult = callback(scope);
|
||||
} catch (e) {
|
||||
this._popScope();
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (is.isThenable(maybePromiseResult)) {
|
||||
// @ts-expect-error - isThenable returns the wrong type
|
||||
return maybePromiseResult.then(
|
||||
res => {
|
||||
this._popScope();
|
||||
return res;
|
||||
},
|
||||
e => {
|
||||
this._popScope();
|
||||
throw e;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
this._popScope();
|
||||
return maybePromiseResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the client of the stack.
|
||||
*/
|
||||
getClient() {
|
||||
return this.getStackTop().client ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the scope of the top stack.
|
||||
*/
|
||||
getScope() {
|
||||
return this.getStackTop().scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the isolation scope for the stack.
|
||||
*/
|
||||
getIsolationScope() {
|
||||
return this._isolationScope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the topmost scope layer in the order domain > local > process.
|
||||
*/
|
||||
getStackTop() {
|
||||
return this._stack[this._stack.length - 1] ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a scope to the stack.
|
||||
*/
|
||||
_pushScope() {
|
||||
// We want to clone the content of prev scope
|
||||
const scope = this.getScope().clone();
|
||||
this._stack.push({
|
||||
client: this.getClient(),
|
||||
scope,
|
||||
});
|
||||
return scope;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop a scope from the stack.
|
||||
*/
|
||||
_popScope() {
|
||||
if (this._stack.length <= 1) return false;
|
||||
return !!this._stack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the global async context stack.
|
||||
* This will be removed during the v8 cycle and is only here to make migration easier.
|
||||
*/
|
||||
function getAsyncContextStack() {
|
||||
const registry = carrier.getMainCarrier();
|
||||
const sentry = carrier.getSentryCarrier(registry);
|
||||
|
||||
return (sentry.stack = sentry.stack || new AsyncContextStack(defaultScopes.getDefaultCurrentScope(), defaultScopes.getDefaultIsolationScope()));
|
||||
}
|
||||
|
||||
function withScope(callback) {
|
||||
return getAsyncContextStack().withScope(callback);
|
||||
}
|
||||
|
||||
function withSetScope(scope, callback) {
|
||||
const stack = getAsyncContextStack() ;
|
||||
return stack.withScope(() => {
|
||||
stack.getStackTop().scope = scope;
|
||||
return callback(scope);
|
||||
});
|
||||
}
|
||||
|
||||
function withIsolationScope(callback) {
|
||||
return getAsyncContextStack().withScope(() => {
|
||||
return callback(getAsyncContextStack().getIsolationScope());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stack-based async context strategy.
|
||||
*/
|
||||
function getStackAsyncContextStrategy() {
|
||||
return {
|
||||
withIsolationScope,
|
||||
withScope,
|
||||
withSetScope,
|
||||
withSetIsolationScope: (_isolationScope, callback) => {
|
||||
return withIsolationScope(callback);
|
||||
},
|
||||
getCurrentScope: () => getAsyncContextStack().getScope(),
|
||||
getIsolationScope: () => getAsyncContextStack().getIsolationScope(),
|
||||
};
|
||||
}
|
||||
|
||||
exports.AsyncContextStack = AsyncContextStack;
|
||||
exports.getStackAsyncContextStrategy = getStackAsyncContextStrategy;
|
||||
//# sourceMappingURL=stackStrategy.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/asyncContext/stackStrategy.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
45
dev/env/node_modules/@sentry/core/build/cjs/breadcrumbs.js
generated
vendored
Executable file
45
dev/env/node_modules/@sentry/core/build/cjs/breadcrumbs.js
generated
vendored
Executable file
@@ -0,0 +1,45 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('./currentScopes.js');
|
||||
const debugLogger = require('./utils/debug-logger.js');
|
||||
const time = require('./utils/time.js');
|
||||
|
||||
/**
|
||||
* Default maximum number of breadcrumbs added to an event. Can be overwritten
|
||||
* with {@link Options.maxBreadcrumbs}.
|
||||
*/
|
||||
const DEFAULT_BREADCRUMBS = 100;
|
||||
|
||||
/**
|
||||
* Records a new breadcrumb which will be attached to future events.
|
||||
*
|
||||
* Breadcrumbs will be added to subsequent events to provide more context on
|
||||
* user's actions prior to an error or crash.
|
||||
*/
|
||||
function addBreadcrumb(breadcrumb, hint) {
|
||||
const client = currentScopes.getClient();
|
||||
const isolationScope = currentScopes.getIsolationScope();
|
||||
|
||||
if (!client) return;
|
||||
|
||||
const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions();
|
||||
|
||||
if (maxBreadcrumbs <= 0) return;
|
||||
|
||||
const timestamp = time.dateTimestampInSeconds();
|
||||
const mergedBreadcrumb = { timestamp, ...breadcrumb };
|
||||
const finalBreadcrumb = beforeBreadcrumb
|
||||
? (debugLogger.consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) )
|
||||
: mergedBreadcrumb;
|
||||
|
||||
if (finalBreadcrumb === null) return;
|
||||
|
||||
if (client.emit) {
|
||||
client.emit('beforeAddBreadcrumb', finalBreadcrumb, hint);
|
||||
}
|
||||
|
||||
isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);
|
||||
}
|
||||
|
||||
exports.addBreadcrumb = addBreadcrumb;
|
||||
//# sourceMappingURL=breadcrumbs.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/breadcrumbs.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/breadcrumbs.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"breadcrumbs.js","sources":["../../src/breadcrumbs.ts"],"sourcesContent":["import { getClient, getIsolationScope } from './currentScopes';\nimport type { Breadcrumb, BreadcrumbHint } from './types-hoist/breadcrumb';\nimport { consoleSandbox } from './utils/debug-logger';\nimport { dateTimestampInSeconds } from './utils/time';\n\n/**\n * Default maximum number of breadcrumbs added to an event. Can be overwritten\n * with {@link Options.maxBreadcrumbs}.\n */\nconst DEFAULT_BREADCRUMBS = 100;\n\n/**\n * Records a new breadcrumb which will be attached to future events.\n *\n * Breadcrumbs will be added to subsequent events to provide more context on\n * user's actions prior to an error or crash.\n */\nexport function addBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): void {\n const client = getClient();\n const isolationScope = getIsolationScope();\n\n if (!client) return;\n\n const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } = client.getOptions();\n\n if (maxBreadcrumbs <= 0) return;\n\n const timestamp = dateTimestampInSeconds();\n const mergedBreadcrumb = { timestamp, ...breadcrumb };\n const finalBreadcrumb = beforeBreadcrumb\n ? (consoleSandbox(() => beforeBreadcrumb(mergedBreadcrumb, hint)) as Breadcrumb | null)\n : mergedBreadcrumb;\n\n if (finalBreadcrumb === null) return;\n\n if (client.emit) {\n client.emit('beforeAddBreadcrumb', finalBreadcrumb, hint);\n }\n\n isolationScope.addBreadcrumb(finalBreadcrumb, maxBreadcrumbs);\n}\n"],"names":["getClient","getIsolationScope","dateTimestampInSeconds","consoleSandbox"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACA,MAAM,mBAAA,GAAsB,GAAG;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,aAAa,CAAC,UAAU,EAAc,IAAI,EAAyB;AACnF,EAAE,MAAM,MAAA,GAASA,uBAAS,EAAE;AAC5B,EAAE,MAAM,cAAA,GAAiBC,+BAAiB,EAAE;;AAE5C,EAAE,IAAI,CAAC,MAAM,EAAE;;AAEf,EAAE,MAAM,EAAE,gBAAA,GAAmB,IAAI,EAAE,cAAA,GAAiB,mBAAA,KAAwB,MAAM,CAAC,UAAU,EAAE;;AAE/F,EAAE,IAAI,cAAA,IAAkB,CAAC,EAAE;;AAE3B,EAAE,MAAM,SAAA,GAAYC,2BAAsB,EAAE;AAC5C,EAAE,MAAM,mBAAmB,EAAE,SAAS,EAAE,GAAG,YAAY;AACvD,EAAE,MAAM,kBAAkB;AAC1B,OAAOC,0BAAc,CAAC,MAAM,gBAAgB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAA;AACpE,MAAM,gBAAgB;;AAEtB,EAAE,IAAI,eAAA,KAAoB,IAAI,EAAE;;AAEhC,EAAE,IAAI,MAAM,CAAC,IAAI,EAAE;AACnB,IAAI,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,eAAe,EAAE,IAAI,CAAC;AAC7D;;AAEA,EAAE,cAAc,CAAC,aAAa,CAAC,eAAe,EAAE,cAAc,CAAC;AAC/D;;;;"}
|
||||
61
dev/env/node_modules/@sentry/core/build/cjs/carrier.js
generated
vendored
Executable file
61
dev/env/node_modules/@sentry/core/build/cjs/carrier.js
generated
vendored
Executable file
@@ -0,0 +1,61 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const version = require('./utils/version.js');
|
||||
const worldwide = require('./utils/worldwide.js');
|
||||
|
||||
/**
|
||||
* An object that contains globally accessible properties and maintains a scope stack.
|
||||
* @hidden
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the global shim registry.
|
||||
*
|
||||
* FIXME: This function is problematic, because despite always returning a valid Carrier,
|
||||
* it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check
|
||||
* at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.
|
||||
**/
|
||||
function getMainCarrier() {
|
||||
// This ensures a Sentry carrier exists
|
||||
getSentryCarrier(worldwide.GLOBAL_OBJ);
|
||||
return worldwide.GLOBAL_OBJ;
|
||||
}
|
||||
|
||||
/** Will either get the existing sentry carrier, or create a new one. */
|
||||
function getSentryCarrier(carrier) {
|
||||
const __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});
|
||||
|
||||
// For now: First SDK that sets the .version property wins
|
||||
__SENTRY__.version = __SENTRY__.version || version.SDK_VERSION;
|
||||
|
||||
// Intentionally populating and returning the version of "this" SDK instance
|
||||
// rather than what's set in .version so that "this" SDK always gets its carrier
|
||||
return (__SENTRY__[version.SDK_VERSION] = __SENTRY__[version.SDK_VERSION] || {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a global singleton contained in the global `__SENTRY__[]` object.
|
||||
*
|
||||
* If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory
|
||||
* function and added to the `__SENTRY__` object.
|
||||
*
|
||||
* @param name name of the global singleton on __SENTRY__
|
||||
* @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`
|
||||
* @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value
|
||||
* @returns the singleton
|
||||
*/
|
||||
function getGlobalSingleton(
|
||||
name,
|
||||
creator,
|
||||
obj = worldwide.GLOBAL_OBJ,
|
||||
) {
|
||||
const __SENTRY__ = (obj.__SENTRY__ = obj.__SENTRY__ || {});
|
||||
const carrier = (__SENTRY__[version.SDK_VERSION] = __SENTRY__[version.SDK_VERSION] || {});
|
||||
// Note: We do not want to set `carrier.version` here, as this may be called before any `init` is called, e.g. for the default scopes
|
||||
return carrier[name] || (carrier[name] = creator());
|
||||
}
|
||||
|
||||
exports.getGlobalSingleton = getGlobalSingleton;
|
||||
exports.getMainCarrier = getMainCarrier;
|
||||
exports.getSentryCarrier = getSentryCarrier;
|
||||
//# sourceMappingURL=carrier.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/carrier.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/carrier.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"carrier.js","sources":["../../src/carrier.ts"],"sourcesContent":["import type { AsyncContextStack } from './asyncContext/stackStrategy';\nimport type { AsyncContextStrategy } from './asyncContext/types';\nimport type { Client } from './client';\nimport type { Scope } from './scope';\nimport type { SerializedLog } from './types-hoist/log';\nimport type { Logger } from './utils/debug-logger';\nimport { SDK_VERSION } from './utils/version';\nimport { GLOBAL_OBJ } from './utils/worldwide';\n\n/**\n * An object that contains globally accessible properties and maintains a scope stack.\n * @hidden\n */\nexport interface Carrier {\n __SENTRY__?: VersionedCarrier;\n}\n\ntype VersionedCarrier = {\n version?: string;\n} & Record<Exclude<string, 'version'>, SentryCarrier>;\n\nexport interface SentryCarrier {\n acs?: AsyncContextStrategy;\n stack?: AsyncContextStack;\n\n globalScope?: Scope;\n defaultIsolationScope?: Scope;\n defaultCurrentScope?: Scope;\n /** @deprecated Logger is no longer set. Instead, we keep enabled state in loggerSettings. */\n // eslint-disable-next-line deprecation/deprecation\n logger?: Logger;\n loggerSettings?: { enabled: boolean };\n /**\n * A map of Sentry clients to their log buffers.\n * This is used to store logs that are sent to Sentry.\n */\n clientToLogBufferMap?: WeakMap<Client, Array<SerializedLog>>;\n\n /** Overwrites TextEncoder used in `@sentry/core`, need for `react-native@0.73` and older */\n encodePolyfill?: (input: string) => Uint8Array;\n /** Overwrites TextDecoder used in `@sentry/core`, need for `react-native@0.73` and older */\n decodePolyfill?: (input: Uint8Array) => string;\n}\n\n/**\n * Returns the global shim registry.\n *\n * FIXME: This function is problematic, because despite always returning a valid Carrier,\n * it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check\n * at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.\n **/\nexport function getMainCarrier(): Carrier {\n // This ensures a Sentry carrier exists\n getSentryCarrier(GLOBAL_OBJ);\n return GLOBAL_OBJ;\n}\n\n/** Will either get the existing sentry carrier, or create a new one. */\nexport function getSentryCarrier(carrier: Carrier): SentryCarrier {\n const __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});\n\n // For now: First SDK that sets the .version property wins\n __SENTRY__.version = __SENTRY__.version || SDK_VERSION;\n\n // Intentionally populating and returning the version of \"this\" SDK instance\n // rather than what's set in .version so that \"this\" SDK always gets its carrier\n return (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});\n}\n\n/**\n * Returns a global singleton contained in the global `__SENTRY__[]` object.\n *\n * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory\n * function and added to the `__SENTRY__` object.\n *\n * @param name name of the global singleton on __SENTRY__\n * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`\n * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value\n * @returns the singleton\n */\nexport function getGlobalSingleton<Prop extends keyof SentryCarrier>(\n name: Prop,\n creator: () => NonNullable<SentryCarrier[Prop]>,\n obj = GLOBAL_OBJ,\n): NonNullable<SentryCarrier[Prop]> {\n const __SENTRY__ = (obj.__SENTRY__ = obj.__SENTRY__ || {});\n const carrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});\n // Note: We do not want to set `carrier.version` here, as this may be called before any `init` is called, e.g. for the default scopes\n return carrier[name] || (carrier[name] = creator());\n}\n"],"names":["GLOBAL_OBJ","SDK_VERSION"],"mappings":";;;;;AASA;AACA;AACA;AACA;;AAgCA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,cAAc,GAAY;AAC1C;AACA,EAAE,gBAAgB,CAACA,oBAAU,CAAC;AAC9B,EAAE,OAAOA,oBAAU;AACnB;;AAEA;AACO,SAAS,gBAAgB,CAAC,OAAO,EAA0B;AAClE,EAAE,MAAM,UAAA,IAAc,OAAO,CAAC,UAAA,GAAa,OAAO,CAAC,UAAA,IAAc,EAAE,CAAC;;AAEpE;AACA,EAAE,UAAU,CAAC,OAAA,GAAU,UAAU,CAAC,OAAA,IAAWC,mBAAW;;AAExD;AACA;AACA,EAAE,QAAQ,UAAU,CAACA,mBAAW,CAAA,GAAI,UAAU,CAACA,mBAAW,CAAA,IAAK,EAAE;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB;AAClC,EAAE,IAAI;AACN,EAAE,OAAO;AACT,EAAE,GAAA,GAAMD,oBAAU;AAClB,EAAoC;AACpC,EAAE,MAAM,UAAA,IAAc,GAAG,CAAC,UAAA,GAAa,GAAG,CAAC,UAAA,IAAc,EAAE,CAAC;AAC5D,EAAE,MAAM,OAAA,IAAW,UAAU,CAACC,mBAAW,CAAA,GAAI,UAAU,CAACA,mBAAW,CAAA,IAAK,EAAE,CAAC;AAC3E;AACA,EAAE,OAAO,OAAO,CAAC,IAAI,MAAM,OAAO,CAAC,IAAI,CAAA,GAAI,OAAO,EAAE,CAAC;AACrD;;;;;;"}
|
||||
47
dev/env/node_modules/@sentry/core/build/cjs/checkin.js
generated
vendored
Executable file
47
dev/env/node_modules/@sentry/core/build/cjs/checkin.js
generated
vendored
Executable file
@@ -0,0 +1,47 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const dsn = require('./utils/dsn.js');
|
||||
const envelope = require('./utils/envelope.js');
|
||||
|
||||
/**
|
||||
* Create envelope from check in item.
|
||||
*/
|
||||
function createCheckInEnvelope(
|
||||
checkIn,
|
||||
dynamicSamplingContext,
|
||||
metadata,
|
||||
tunnel,
|
||||
dsn$1,
|
||||
) {
|
||||
const headers = {
|
||||
sent_at: new Date().toISOString(),
|
||||
};
|
||||
|
||||
if (metadata?.sdk) {
|
||||
headers.sdk = {
|
||||
name: metadata.sdk.name,
|
||||
version: metadata.sdk.version,
|
||||
};
|
||||
}
|
||||
|
||||
if (!!tunnel && !!dsn$1) {
|
||||
headers.dsn = dsn.dsnToString(dsn$1);
|
||||
}
|
||||
|
||||
if (dynamicSamplingContext) {
|
||||
headers.trace = dynamicSamplingContext ;
|
||||
}
|
||||
|
||||
const item = createCheckInEnvelopeItem(checkIn);
|
||||
return envelope.createEnvelope(headers, [item]);
|
||||
}
|
||||
|
||||
function createCheckInEnvelopeItem(checkIn) {
|
||||
const checkInHeaders = {
|
||||
type: 'check_in',
|
||||
};
|
||||
return [checkInHeaders, checkIn];
|
||||
}
|
||||
|
||||
exports.createCheckInEnvelope = createCheckInEnvelope;
|
||||
//# sourceMappingURL=checkin.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/checkin.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/checkin.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"checkin.js","sources":["../../src/checkin.ts"],"sourcesContent":["import type { SerializedCheckIn } from './types-hoist/checkin';\nimport type { DsnComponents } from './types-hoist/dsn';\nimport type { CheckInEnvelope, CheckInItem, DynamicSamplingContext } from './types-hoist/envelope';\nimport type { SdkMetadata } from './types-hoist/sdkmetadata';\nimport { dsnToString } from './utils/dsn';\nimport { createEnvelope } from './utils/envelope';\n\n/**\n * Create envelope from check in item.\n */\nexport function createCheckInEnvelope(\n checkIn: SerializedCheckIn,\n dynamicSamplingContext?: Partial<DynamicSamplingContext>,\n metadata?: SdkMetadata,\n tunnel?: string,\n dsn?: DsnComponents,\n): CheckInEnvelope {\n const headers: CheckInEnvelope[0] = {\n sent_at: new Date().toISOString(),\n };\n\n if (metadata?.sdk) {\n headers.sdk = {\n name: metadata.sdk.name,\n version: metadata.sdk.version,\n };\n }\n\n if (!!tunnel && !!dsn) {\n headers.dsn = dsnToString(dsn);\n }\n\n if (dynamicSamplingContext) {\n headers.trace = dynamicSamplingContext as DynamicSamplingContext;\n }\n\n const item = createCheckInEnvelopeItem(checkIn);\n return createEnvelope<CheckInEnvelope>(headers, [item]);\n}\n\nfunction createCheckInEnvelopeItem(checkIn: SerializedCheckIn): CheckInItem {\n const checkInHeaders: CheckInItem[0] = {\n type: 'check_in',\n };\n return [checkInHeaders, checkIn];\n}\n"],"names":["dsn","dsnToString","createEnvelope"],"mappings":";;;;;AAOA;AACA;AACA;AACO,SAAS,qBAAqB;AACrC,EAAE,OAAO;AACT,EAAE,sBAAsB;AACxB,EAAE,QAAQ;AACV,EAAE,MAAM;AACR,EAAEA,KAAG;AACL,EAAmB;AACnB,EAAE,MAAM,OAAO,GAAuB;AACtC,IAAI,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;AACrC,GAAG;;AAEH,EAAE,IAAI,QAAQ,EAAE,GAAG,EAAE;AACrB,IAAI,OAAO,CAAC,GAAA,GAAM;AAClB,MAAM,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI;AAC7B,MAAM,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO;AACnC,KAAK;AACL;;AAEA,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,CAACA,KAAG,EAAE;AACzB,IAAI,OAAO,CAAC,GAAA,GAAMC,eAAW,CAACD,KAAG,CAAC;AAClC;;AAEA,EAAE,IAAI,sBAAsB,EAAE;AAC9B,IAAI,OAAO,CAAC,KAAA,GAAQ,sBAAA;AACpB;;AAEA,EAAE,MAAM,IAAA,GAAO,yBAAyB,CAAC,OAAO,CAAC;AACjD,EAAE,OAAOE,uBAAc,CAAkB,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;AACzD;;AAEA,SAAS,yBAAyB,CAAC,OAAO,EAAkC;AAC5E,EAAE,MAAM,cAAc,GAAmB;AACzC,IAAI,IAAI,EAAE,UAAU;AACpB,GAAG;AACH,EAAE,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC;AAClC;;;;"}
|
||||
966
dev/env/node_modules/@sentry/core/build/cjs/client.js
generated
vendored
Executable file
966
dev/env/node_modules/@sentry/core/build/cjs/client.js
generated
vendored
Executable file
@@ -0,0 +1,966 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const api = require('./api.js');
|
||||
const constants = require('./constants.js');
|
||||
const currentScopes = require('./currentScopes.js');
|
||||
const debugBuild = require('./debug-build.js');
|
||||
const envelope = require('./envelope.js');
|
||||
const integration = require('./integration.js');
|
||||
const session = require('./session.js');
|
||||
const dynamicSamplingContext = require('./tracing/dynamicSamplingContext.js');
|
||||
const clientreport = require('./utils/clientreport.js');
|
||||
const debugLogger = require('./utils/debug-logger.js');
|
||||
const dsn = require('./utils/dsn.js');
|
||||
const envelope$1 = require('./utils/envelope.js');
|
||||
const eventUtils = require('./utils/eventUtils.js');
|
||||
const is = require('./utils/is.js');
|
||||
const merge = require('./utils/merge.js');
|
||||
const misc = require('./utils/misc.js');
|
||||
const parseSampleRate = require('./utils/parseSampleRate.js');
|
||||
const prepareEvent = require('./utils/prepareEvent.js');
|
||||
const spanUtils = require('./utils/spanUtils.js');
|
||||
const syncpromise = require('./utils/syncpromise.js');
|
||||
const transactionEvent = require('./utils/transactionEvent.js');
|
||||
|
||||
/* eslint-disable max-lines */
|
||||
|
||||
const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured.";
|
||||
const MISSING_RELEASE_FOR_SESSION_ERROR = 'Discarded session because of missing or non-string release';
|
||||
|
||||
const INTERNAL_ERROR_SYMBOL = Symbol.for('SentryInternalError');
|
||||
const DO_NOT_SEND_EVENT_SYMBOL = Symbol.for('SentryDoNotSendEventError');
|
||||
|
||||
function _makeInternalError(message) {
|
||||
return {
|
||||
message,
|
||||
[INTERNAL_ERROR_SYMBOL]: true,
|
||||
};
|
||||
}
|
||||
|
||||
function _makeDoNotSendEventError(message) {
|
||||
return {
|
||||
message,
|
||||
[DO_NOT_SEND_EVENT_SYMBOL]: true,
|
||||
};
|
||||
}
|
||||
|
||||
function _isInternalError(error) {
|
||||
return !!error && typeof error === 'object' && INTERNAL_ERROR_SYMBOL in error;
|
||||
}
|
||||
|
||||
function _isDoNotSendEventError(error) {
|
||||
return !!error && typeof error === 'object' && DO_NOT_SEND_EVENT_SYMBOL in error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base implementation for all JavaScript SDK clients.
|
||||
*
|
||||
* Call the constructor with the corresponding options
|
||||
* specific to the client subclass. To access these options later, use
|
||||
* {@link Client.getOptions}.
|
||||
*
|
||||
* If a Dsn is specified in the options, it will be parsed and stored. Use
|
||||
* {@link Client.getDsn} to retrieve the Dsn at any moment. In case the Dsn is
|
||||
* invalid, the constructor will throw a {@link SentryException}. Note that
|
||||
* without a valid Dsn, the SDK will not send any events to Sentry.
|
||||
*
|
||||
* Before sending an event, it is passed through
|
||||
* {@link Client._prepareEvent} to add SDK information and scope data
|
||||
* (breadcrumbs and context). To add more custom information, override this
|
||||
* method and extend the resulting prepared event.
|
||||
*
|
||||
* To issue automatically created events (e.g. via instrumentation), use
|
||||
* {@link Client.captureEvent}. It will prepare the event and pass it through
|
||||
* the callback lifecycle. To issue auto-breadcrumbs, use
|
||||
* {@link Client.addBreadcrumb}.
|
||||
*
|
||||
* @example
|
||||
* class NodeClient extends Client<NodeOptions> {
|
||||
* public constructor(options: NodeOptions) {
|
||||
* super(options);
|
||||
* }
|
||||
*
|
||||
* // ...
|
||||
* }
|
||||
*/
|
||||
class Client {
|
||||
/** Options passed to the SDK. */
|
||||
|
||||
/** The client Dsn, if specified in options. Without this Dsn, the SDK will be disabled. */
|
||||
|
||||
/** Array of set up integrations. */
|
||||
|
||||
/** Number of calls being processed */
|
||||
|
||||
/** Holds flushable */
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
|
||||
/**
|
||||
* Initializes this client instance.
|
||||
*
|
||||
* @param options Options for the client.
|
||||
*/
|
||||
constructor(options) {
|
||||
this._options = options;
|
||||
this._integrations = {};
|
||||
this._numProcessing = 0;
|
||||
this._outcomes = {};
|
||||
this._hooks = {};
|
||||
this._eventProcessors = [];
|
||||
|
||||
if (options.dsn) {
|
||||
this._dsn = dsn.makeDsn(options.dsn);
|
||||
} else {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('No DSN provided, client will not send events.');
|
||||
}
|
||||
|
||||
if (this._dsn) {
|
||||
const url = api.getEnvelopeEndpointWithUrlEncodedAuth(
|
||||
this._dsn,
|
||||
options.tunnel,
|
||||
options._metadata ? options._metadata.sdk : undefined,
|
||||
);
|
||||
this._transport = options.transport({
|
||||
tunnel: this._options.tunnel,
|
||||
recordDroppedEvent: this.recordDroppedEvent.bind(this),
|
||||
...options.transportOptions,
|
||||
url,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures an exception event and sends it to Sentry.
|
||||
*
|
||||
* Unlike `captureException` exported from every SDK, this method requires that you pass it the current scope.
|
||||
*/
|
||||
captureException(exception, hint, scope) {
|
||||
const eventId = misc.uuid4();
|
||||
|
||||
// ensure we haven't captured this very object before
|
||||
if (misc.checkOrSetAlreadyCaught(exception)) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log(ALREADY_SEEN_ERROR);
|
||||
return eventId;
|
||||
}
|
||||
|
||||
const hintWithEventId = {
|
||||
event_id: eventId,
|
||||
...hint,
|
||||
};
|
||||
|
||||
this._process(
|
||||
this.eventFromException(exception, hintWithEventId).then(event =>
|
||||
this._captureEvent(event, hintWithEventId, scope),
|
||||
),
|
||||
);
|
||||
|
||||
return hintWithEventId.event_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures a message event and sends it to Sentry.
|
||||
*
|
||||
* Unlike `captureMessage` exported from every SDK, this method requires that you pass it the current scope.
|
||||
*/
|
||||
captureMessage(
|
||||
message,
|
||||
level,
|
||||
hint,
|
||||
currentScope,
|
||||
) {
|
||||
const hintWithEventId = {
|
||||
event_id: misc.uuid4(),
|
||||
...hint,
|
||||
};
|
||||
|
||||
const eventMessage = is.isParameterizedString(message) ? message : String(message);
|
||||
|
||||
const promisedEvent = is.isPrimitive(message)
|
||||
? this.eventFromMessage(eventMessage, level, hintWithEventId)
|
||||
: this.eventFromException(message, hintWithEventId);
|
||||
|
||||
this._process(promisedEvent.then(event => this._captureEvent(event, hintWithEventId, currentScope)));
|
||||
|
||||
return hintWithEventId.event_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures a manually created event and sends it to Sentry.
|
||||
*
|
||||
* Unlike `captureEvent` exported from every SDK, this method requires that you pass it the current scope.
|
||||
*/
|
||||
captureEvent(event, hint, currentScope) {
|
||||
const eventId = misc.uuid4();
|
||||
|
||||
// ensure we haven't captured this very object before
|
||||
if (hint?.originalException && misc.checkOrSetAlreadyCaught(hint.originalException)) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log(ALREADY_SEEN_ERROR);
|
||||
return eventId;
|
||||
}
|
||||
|
||||
const hintWithEventId = {
|
||||
event_id: eventId,
|
||||
...hint,
|
||||
};
|
||||
|
||||
const sdkProcessingMetadata = event.sdkProcessingMetadata || {};
|
||||
const capturedSpanScope = sdkProcessingMetadata.capturedSpanScope;
|
||||
const capturedSpanIsolationScope = sdkProcessingMetadata.capturedSpanIsolationScope;
|
||||
|
||||
this._process(
|
||||
this._captureEvent(event, hintWithEventId, capturedSpanScope || currentScope, capturedSpanIsolationScope),
|
||||
);
|
||||
|
||||
return hintWithEventId.event_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures a session.
|
||||
*/
|
||||
captureSession(session$1) {
|
||||
this.sendSession(session$1);
|
||||
// After sending, we set init false to indicate it's not the first occurrence
|
||||
session.updateSession(session$1, { init: false });
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a cron monitor check in and send it to Sentry. This method is not available on all clients.
|
||||
*
|
||||
* @param checkIn An object that describes a check in.
|
||||
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
|
||||
* to create a monitor automatically when sending a check in.
|
||||
* @param scope An optional scope containing event metadata.
|
||||
* @returns A string representing the id of the check in.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the current Dsn.
|
||||
*/
|
||||
getDsn() {
|
||||
return this._dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current options.
|
||||
*/
|
||||
getOptions() {
|
||||
return this._options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the SDK metadata.
|
||||
* @see SdkMetadata
|
||||
*/
|
||||
getSdkMetadata() {
|
||||
return this._options._metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the transport that is used by the client.
|
||||
* Please note that the transport gets lazy initialized so it will only be there once the first event has been sent.
|
||||
*/
|
||||
getTransport() {
|
||||
return this._transport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for all events to be sent or the timeout to expire, whichever comes first.
|
||||
*
|
||||
* @param timeout Maximum time in ms the client should wait for events to be flushed. Omitting this parameter will
|
||||
* cause the client to wait until all events are sent before resolving the promise.
|
||||
* @returns A promise that will resolve with `true` if all events are sent before the timeout, or `false` if there are
|
||||
* still events in the queue when the timeout is reached.
|
||||
*/
|
||||
flush(timeout) {
|
||||
const transport = this._transport;
|
||||
if (transport) {
|
||||
this.emit('flush');
|
||||
return this._isClientDoneProcessing(timeout).then(clientFinished => {
|
||||
return transport.flush(timeout).then(transportFlushed => clientFinished && transportFlushed);
|
||||
});
|
||||
} else {
|
||||
return syncpromise.resolvedSyncPromise(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Flush the event queue and set the client to `enabled = false`. See {@link Client.flush}.
|
||||
*
|
||||
* @param {number} timeout Maximum time in ms the client should wait before shutting down. Omitting this parameter will cause
|
||||
* the client to wait until all events are sent before disabling itself.
|
||||
* @returns {Promise<boolean>} A promise which resolves to `true` if the flush completes successfully before the timeout, or `false` if
|
||||
* it doesn't.
|
||||
*/
|
||||
close(timeout) {
|
||||
return this.flush(timeout).then(result => {
|
||||
this.getOptions().enabled = false;
|
||||
this.emit('close');
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all installed event processors.
|
||||
*/
|
||||
getEventProcessors() {
|
||||
return this._eventProcessors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an event processor that applies to any event processed by this client.
|
||||
*/
|
||||
addEventProcessor(eventProcessor) {
|
||||
this._eventProcessors.push(eventProcessor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize this client.
|
||||
* Call this after the client was set on a scope.
|
||||
*/
|
||||
init() {
|
||||
if (
|
||||
this._isEnabled() ||
|
||||
// Force integrations to be setup even if no DSN was set when we have
|
||||
// Spotlight enabled. This is particularly important for browser as we
|
||||
// don't support the `spotlight` option there and rely on the users
|
||||
// adding the `spotlightBrowserIntegration()` to their integrations which
|
||||
// wouldn't get initialized with the check below when there's no DSN set.
|
||||
this._options.integrations.some(({ name }) => name.startsWith('Spotlight'))
|
||||
) {
|
||||
this._setupIntegrations();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an installed integration by its name.
|
||||
*
|
||||
* @returns {Integration|undefined} The installed integration or `undefined` if no integration with that `name` was installed.
|
||||
*/
|
||||
getIntegrationByName(integrationName) {
|
||||
return this._integrations[integrationName] ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an integration to the client.
|
||||
* This can be used to e.g. lazy load integrations.
|
||||
* In most cases, this should not be necessary,
|
||||
* and you're better off just passing the integrations via `integrations: []` at initialization time.
|
||||
* However, if you find the need to conditionally load & add an integration, you can use `addIntegration` to do so.
|
||||
*/
|
||||
addIntegration(integration$1) {
|
||||
const isAlreadyInstalled = this._integrations[integration$1.name];
|
||||
|
||||
// This hook takes care of only installing if not already installed
|
||||
integration.setupIntegration(this, integration$1, this._integrations);
|
||||
// Here we need to check manually to make sure to not run this multiple times
|
||||
if (!isAlreadyInstalled) {
|
||||
integration.afterSetupIntegrations(this, [integration$1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a fully prepared event to Sentry.
|
||||
*/
|
||||
sendEvent(event, hint = {}) {
|
||||
this.emit('beforeSendEvent', event, hint);
|
||||
|
||||
let env = envelope.createEventEnvelope(event, this._dsn, this._options._metadata, this._options.tunnel);
|
||||
|
||||
for (const attachment of hint.attachments || []) {
|
||||
env = envelope$1.addItemToEnvelope(env, envelope$1.createAttachmentEnvelopeItem(attachment));
|
||||
}
|
||||
|
||||
const promise = this.sendEnvelope(env);
|
||||
if (promise) {
|
||||
promise.then(sendResponse => this.emit('afterSendEvent', event, sendResponse), null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a session or session aggregrates to Sentry.
|
||||
*/
|
||||
sendSession(session) {
|
||||
// Backfill release and environment on session
|
||||
const { release: clientReleaseOption, environment: clientEnvironmentOption = constants.DEFAULT_ENVIRONMENT } = this._options;
|
||||
if ('aggregates' in session) {
|
||||
const sessionAttrs = session.attrs || {};
|
||||
if (!sessionAttrs.release && !clientReleaseOption) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);
|
||||
return;
|
||||
}
|
||||
sessionAttrs.release = sessionAttrs.release || clientReleaseOption;
|
||||
sessionAttrs.environment = sessionAttrs.environment || clientEnvironmentOption;
|
||||
session.attrs = sessionAttrs;
|
||||
} else {
|
||||
if (!session.release && !clientReleaseOption) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn(MISSING_RELEASE_FOR_SESSION_ERROR);
|
||||
return;
|
||||
}
|
||||
session.release = session.release || clientReleaseOption;
|
||||
session.environment = session.environment || clientEnvironmentOption;
|
||||
}
|
||||
|
||||
this.emit('beforeSendSession', session);
|
||||
|
||||
const env = envelope.createSessionEnvelope(session, this._dsn, this._options._metadata, this._options.tunnel);
|
||||
|
||||
// sendEnvelope should not throw
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.sendEnvelope(env);
|
||||
}
|
||||
|
||||
/**
|
||||
* Record on the client that an event got dropped (ie, an event that will not be sent to Sentry).
|
||||
*/
|
||||
recordDroppedEvent(reason, category, count = 1) {
|
||||
if (this._options.sendClientReports) {
|
||||
// We want to track each category (error, transaction, session, replay_event) separately
|
||||
// but still keep the distinction between different type of outcomes.
|
||||
// We could use nested maps, but it's much easier to read and type this way.
|
||||
// A correct type for map-based implementation if we want to go that route
|
||||
// would be `Partial<Record<SentryRequestType, Partial<Record<Outcome, number>>>>`
|
||||
// With typescript 4.1 we could even use template literal types
|
||||
const key = `${reason}:${category}`;
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log(`Recording outcome: "${key}"${count > 1 ? ` (${count} times)` : ''}`);
|
||||
this._outcomes[key] = (this._outcomes[key] || 0) + count;
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-disable @typescript-eslint/unified-signatures */
|
||||
/**
|
||||
* Register a callback for whenever a span is started.
|
||||
* Receives the span as argument.
|
||||
* @returns {() => void} A function that, when executed, removes the registered callback.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Register a hook on this client.
|
||||
*/
|
||||
on(hook, callback) {
|
||||
const hooks = (this._hooks[hook] = this._hooks[hook] || []);
|
||||
|
||||
// @ts-expect-error We assume the types are correct
|
||||
hooks.push(callback);
|
||||
|
||||
// This function returns a callback execution handler that, when invoked,
|
||||
// deregisters a callback. This is crucial for managing instances where callbacks
|
||||
// need to be unregistered to prevent self-referencing in callback closures,
|
||||
// ensuring proper garbage collection.
|
||||
return () => {
|
||||
// @ts-expect-error We assume the types are correct
|
||||
const cbIndex = hooks.indexOf(callback);
|
||||
if (cbIndex > -1) {
|
||||
hooks.splice(cbIndex, 1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** Fire a hook whenever a span starts. */
|
||||
|
||||
/**
|
||||
* Emit a hook that was previously registered via `on()`.
|
||||
*/
|
||||
emit(hook, ...rest) {
|
||||
const callbacks = this._hooks[hook];
|
||||
if (callbacks) {
|
||||
callbacks.forEach(callback => callback(...rest));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an envelope to Sentry.
|
||||
*/
|
||||
sendEnvelope(envelope) {
|
||||
this.emit('beforeEnvelope', envelope);
|
||||
|
||||
if (this._isEnabled() && this._transport) {
|
||||
return this._transport.send(envelope).then(null, reason => {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.error('Error while sending envelope:', reason);
|
||||
return reason;
|
||||
});
|
||||
}
|
||||
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.error('Transport disabled');
|
||||
|
||||
return syncpromise.resolvedSyncPromise({});
|
||||
}
|
||||
|
||||
/* eslint-enable @typescript-eslint/unified-signatures */
|
||||
|
||||
/** Setup integrations for this client. */
|
||||
_setupIntegrations() {
|
||||
const { integrations } = this._options;
|
||||
this._integrations = integration.setupIntegrations(this, integrations);
|
||||
integration.afterSetupIntegrations(this, integrations);
|
||||
}
|
||||
|
||||
/** Updates existing session based on the provided event */
|
||||
_updateSessionFromEvent(session$1, event) {
|
||||
let crashed = event.level === 'fatal';
|
||||
let errored = false;
|
||||
const exceptions = event.exception?.values;
|
||||
|
||||
if (exceptions) {
|
||||
errored = true;
|
||||
|
||||
for (const ex of exceptions) {
|
||||
const mechanism = ex.mechanism;
|
||||
if (mechanism?.handled === false) {
|
||||
crashed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A session is updated and that session update is sent in only one of the two following scenarios:
|
||||
// 1. Session with non terminal status and 0 errors + an error occurred -> Will set error count to 1 and send update
|
||||
// 2. Session with non terminal status and 1 error + a crash occurred -> Will set status crashed and send update
|
||||
const sessionNonTerminal = session$1.status === 'ok';
|
||||
const shouldUpdateAndSend = (sessionNonTerminal && session$1.errors === 0) || (sessionNonTerminal && crashed);
|
||||
|
||||
if (shouldUpdateAndSend) {
|
||||
session.updateSession(session$1, {
|
||||
...(crashed && { status: 'crashed' }),
|
||||
errors: session$1.errors || Number(errored || crashed),
|
||||
});
|
||||
this.captureSession(session$1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the client is finished processing. Returns a promise because it will wait `timeout` ms before saying
|
||||
* "no" (resolving to `false`) in order to give the client a chance to potentially finish first.
|
||||
*
|
||||
* @param timeout The time, in ms, after which to resolve to `false` if the client is still busy. Passing `0` (or not
|
||||
* passing anything) will make the promise wait as long as it takes for processing to finish before resolving to
|
||||
* `true`.
|
||||
* @returns A promise which will resolve to `true` if processing is already done or finishes before the timeout, and
|
||||
* `false` otherwise
|
||||
*/
|
||||
_isClientDoneProcessing(timeout) {
|
||||
return new syncpromise.SyncPromise(resolve => {
|
||||
let ticked = 0;
|
||||
const tick = 1;
|
||||
|
||||
const interval = setInterval(() => {
|
||||
if (this._numProcessing == 0) {
|
||||
clearInterval(interval);
|
||||
resolve(true);
|
||||
} else {
|
||||
ticked += tick;
|
||||
if (timeout && ticked >= timeout) {
|
||||
clearInterval(interval);
|
||||
resolve(false);
|
||||
}
|
||||
}
|
||||
}, tick);
|
||||
});
|
||||
}
|
||||
|
||||
/** Determines whether this SDK is enabled and a transport is present. */
|
||||
_isEnabled() {
|
||||
return this.getOptions().enabled !== false && this._transport !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds common information to events.
|
||||
*
|
||||
* The information includes release and environment from `options`,
|
||||
* breadcrumbs and context (extra, tags and user) from the scope.
|
||||
*
|
||||
* Information that is already present in the event is never overwritten. For
|
||||
* nested objects, such as the context, keys are merged.
|
||||
*
|
||||
* @param event The original event.
|
||||
* @param hint May contain additional information about the original exception.
|
||||
* @param currentScope A scope containing event metadata.
|
||||
* @returns A new event with more information.
|
||||
*/
|
||||
_prepareEvent(
|
||||
event,
|
||||
hint,
|
||||
currentScope,
|
||||
isolationScope,
|
||||
) {
|
||||
const options = this.getOptions();
|
||||
const integrations = Object.keys(this._integrations);
|
||||
if (!hint.integrations && integrations?.length) {
|
||||
hint.integrations = integrations;
|
||||
}
|
||||
|
||||
this.emit('preprocessEvent', event, hint);
|
||||
|
||||
if (!event.type) {
|
||||
isolationScope.setLastEventId(event.event_id || hint.event_id);
|
||||
}
|
||||
|
||||
return prepareEvent.prepareEvent(options, event, hint, currentScope, this, isolationScope).then(evt => {
|
||||
if (evt === null) {
|
||||
return evt;
|
||||
}
|
||||
|
||||
this.emit('postprocessEvent', evt, hint);
|
||||
|
||||
evt.contexts = {
|
||||
trace: currentScopes.getTraceContextFromScope(currentScope),
|
||||
...evt.contexts,
|
||||
};
|
||||
|
||||
const dynamicSamplingContext$1 = dynamicSamplingContext.getDynamicSamplingContextFromScope(this, currentScope);
|
||||
|
||||
evt.sdkProcessingMetadata = {
|
||||
dynamicSamplingContext: dynamicSamplingContext$1,
|
||||
...evt.sdkProcessingMetadata,
|
||||
};
|
||||
|
||||
return evt;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the event and logs an error in case of rejection
|
||||
* @param event
|
||||
* @param hint
|
||||
* @param scope
|
||||
*/
|
||||
_captureEvent(
|
||||
event,
|
||||
hint = {},
|
||||
currentScope = currentScopes.getCurrentScope(),
|
||||
isolationScope = currentScopes.getIsolationScope(),
|
||||
) {
|
||||
if (debugBuild.DEBUG_BUILD && isErrorEvent(event)) {
|
||||
debugLogger.debug.log(`Captured error event \`${eventUtils.getPossibleEventMessages(event)[0] || '<unknown>'}\``);
|
||||
}
|
||||
|
||||
return this._processEvent(event, hint, currentScope, isolationScope).then(
|
||||
finalEvent => {
|
||||
return finalEvent.event_id;
|
||||
},
|
||||
reason => {
|
||||
if (debugBuild.DEBUG_BUILD) {
|
||||
if (_isDoNotSendEventError(reason)) {
|
||||
debugLogger.debug.log(reason.message);
|
||||
} else if (_isInternalError(reason)) {
|
||||
debugLogger.debug.warn(reason.message);
|
||||
} else {
|
||||
debugLogger.debug.warn(reason);
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes an event (either error or message) and sends it to Sentry.
|
||||
*
|
||||
* This also adds breadcrumbs and context information to the event. However,
|
||||
* platform specific meta data (such as the User's IP address) must be added
|
||||
* by the SDK implementor.
|
||||
*
|
||||
*
|
||||
* @param event The event to send to Sentry.
|
||||
* @param hint May contain additional information about the original exception.
|
||||
* @param currentScope A scope containing event metadata.
|
||||
* @returns A SyncPromise that resolves with the event or rejects in case event was/will not be send.
|
||||
*/
|
||||
_processEvent(
|
||||
event,
|
||||
hint,
|
||||
currentScope,
|
||||
isolationScope,
|
||||
) {
|
||||
const options = this.getOptions();
|
||||
const { sampleRate } = options;
|
||||
|
||||
const isTransaction = isTransactionEvent(event);
|
||||
const isError = isErrorEvent(event);
|
||||
const eventType = event.type || 'error';
|
||||
const beforeSendLabel = `before send for type \`${eventType}\``;
|
||||
|
||||
// 1.0 === 100% events are sent
|
||||
// 0.0 === 0% events are sent
|
||||
// Sampling for transaction happens somewhere else
|
||||
const parsedSampleRate = typeof sampleRate === 'undefined' ? undefined : parseSampleRate.parseSampleRate(sampleRate);
|
||||
if (isError && typeof parsedSampleRate === 'number' && Math.random() > parsedSampleRate) {
|
||||
this.recordDroppedEvent('sample_rate', 'error');
|
||||
return syncpromise.rejectedSyncPromise(
|
||||
_makeDoNotSendEventError(
|
||||
`Discarding event because it's not included in the random sample (sampling rate = ${sampleRate})`,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
const dataCategory = (eventType === 'replay_event' ? 'replay' : eventType) ;
|
||||
|
||||
return this._prepareEvent(event, hint, currentScope, isolationScope)
|
||||
.then(prepared => {
|
||||
if (prepared === null) {
|
||||
this.recordDroppedEvent('event_processor', dataCategory);
|
||||
throw _makeDoNotSendEventError('An event processor returned `null`, will not send event.');
|
||||
}
|
||||
|
||||
const isInternalException = hint.data && (hint.data ).__sentry__ === true;
|
||||
if (isInternalException) {
|
||||
return prepared;
|
||||
}
|
||||
|
||||
const result = processBeforeSend(this, options, prepared, hint);
|
||||
return _validateBeforeSendResult(result, beforeSendLabel);
|
||||
})
|
||||
.then(processedEvent => {
|
||||
if (processedEvent === null) {
|
||||
this.recordDroppedEvent('before_send', dataCategory);
|
||||
if (isTransaction) {
|
||||
const spans = event.spans || [];
|
||||
// the transaction itself counts as one span, plus all the child spans that are added
|
||||
const spanCount = 1 + spans.length;
|
||||
this.recordDroppedEvent('before_send', 'span', spanCount);
|
||||
}
|
||||
throw _makeDoNotSendEventError(`${beforeSendLabel} returned \`null\`, will not send event.`);
|
||||
}
|
||||
|
||||
const session = currentScope.getSession() || isolationScope.getSession();
|
||||
if (isError && session) {
|
||||
this._updateSessionFromEvent(session, processedEvent);
|
||||
}
|
||||
|
||||
if (isTransaction) {
|
||||
const spanCountBefore = processedEvent.sdkProcessingMetadata?.spanCountBeforeProcessing || 0;
|
||||
const spanCountAfter = processedEvent.spans ? processedEvent.spans.length : 0;
|
||||
|
||||
const droppedSpanCount = spanCountBefore - spanCountAfter;
|
||||
if (droppedSpanCount > 0) {
|
||||
this.recordDroppedEvent('before_send', 'span', droppedSpanCount);
|
||||
}
|
||||
}
|
||||
|
||||
// None of the Sentry built event processor will update transaction name,
|
||||
// so if the transaction name has been changed by an event processor, we know
|
||||
// it has to come from custom event processor added by a user
|
||||
const transactionInfo = processedEvent.transaction_info;
|
||||
if (isTransaction && transactionInfo && processedEvent.transaction !== event.transaction) {
|
||||
const source = 'custom';
|
||||
processedEvent.transaction_info = {
|
||||
...transactionInfo,
|
||||
source,
|
||||
};
|
||||
}
|
||||
|
||||
this.sendEvent(processedEvent, hint);
|
||||
return processedEvent;
|
||||
})
|
||||
.then(null, reason => {
|
||||
if (_isDoNotSendEventError(reason) || _isInternalError(reason)) {
|
||||
throw reason;
|
||||
}
|
||||
|
||||
this.captureException(reason, {
|
||||
data: {
|
||||
__sentry__: true,
|
||||
},
|
||||
originalException: reason,
|
||||
});
|
||||
throw _makeInternalError(
|
||||
`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.\nReason: ${reason}`,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Occupies the client with processing and event
|
||||
*/
|
||||
_process(promise) {
|
||||
this._numProcessing++;
|
||||
void promise.then(
|
||||
value => {
|
||||
this._numProcessing--;
|
||||
return value;
|
||||
},
|
||||
reason => {
|
||||
this._numProcessing--;
|
||||
return reason;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears outcomes on this client and returns them.
|
||||
*/
|
||||
_clearOutcomes() {
|
||||
const outcomes = this._outcomes;
|
||||
this._outcomes = {};
|
||||
return Object.entries(outcomes).map(([key, quantity]) => {
|
||||
const [reason, category] = key.split(':') ;
|
||||
return {
|
||||
reason,
|
||||
category,
|
||||
quantity,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends client reports as an envelope.
|
||||
*/
|
||||
_flushOutcomes() {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log('Flushing outcomes...');
|
||||
|
||||
const outcomes = this._clearOutcomes();
|
||||
|
||||
if (outcomes.length === 0) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log('No outcomes to send');
|
||||
return;
|
||||
}
|
||||
|
||||
// This is really the only place where we want to check for a DSN and only send outcomes then
|
||||
if (!this._dsn) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log('No dsn provided, will not send outcomes');
|
||||
return;
|
||||
}
|
||||
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log('Sending outcomes:', outcomes);
|
||||
|
||||
const envelope = clientreport.createClientReportEnvelope(outcomes, this._options.tunnel && dsn.dsnToString(this._dsn));
|
||||
|
||||
// sendEnvelope should not throw
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.sendEnvelope(envelope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an {@link Event} from all inputs to `captureException` and non-primitive inputs to `captureMessage`.
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
|
||||
*/
|
||||
// TODO(v10): Remove
|
||||
|
||||
/**
|
||||
* @deprecated Use `Client` instead. This alias may be removed in a future major version.
|
||||
*/
|
||||
// TODO(v10): Remove
|
||||
const BaseClient = Client;
|
||||
|
||||
/**
|
||||
* Verifies that return value of configured `beforeSend` or `beforeSendTransaction` is of expected type, and returns the value if so.
|
||||
*/
|
||||
function _validateBeforeSendResult(
|
||||
beforeSendResult,
|
||||
beforeSendLabel,
|
||||
) {
|
||||
const invalidValueError = `${beforeSendLabel} must return \`null\` or a valid event.`;
|
||||
if (is.isThenable(beforeSendResult)) {
|
||||
return beforeSendResult.then(
|
||||
event => {
|
||||
if (!is.isPlainObject(event) && event !== null) {
|
||||
throw _makeInternalError(invalidValueError);
|
||||
}
|
||||
return event;
|
||||
},
|
||||
e => {
|
||||
throw _makeInternalError(`${beforeSendLabel} rejected with ${e}`);
|
||||
},
|
||||
);
|
||||
} else if (!is.isPlainObject(beforeSendResult) && beforeSendResult !== null) {
|
||||
throw _makeInternalError(invalidValueError);
|
||||
}
|
||||
return beforeSendResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the matching `beforeSendXXX` callback.
|
||||
*/
|
||||
function processBeforeSend(
|
||||
client,
|
||||
options,
|
||||
event,
|
||||
hint,
|
||||
) {
|
||||
const { beforeSend, beforeSendTransaction, beforeSendSpan } = options;
|
||||
let processedEvent = event;
|
||||
|
||||
if (isErrorEvent(processedEvent) && beforeSend) {
|
||||
return beforeSend(processedEvent, hint);
|
||||
}
|
||||
|
||||
if (isTransactionEvent(processedEvent)) {
|
||||
if (beforeSendSpan) {
|
||||
// process root span
|
||||
const processedRootSpanJson = beforeSendSpan(transactionEvent.convertTransactionEventToSpanJson(processedEvent));
|
||||
if (!processedRootSpanJson) {
|
||||
spanUtils.showSpanDropWarning();
|
||||
} else {
|
||||
// update event with processed root span values
|
||||
processedEvent = merge.merge(event, transactionEvent.convertSpanJsonToTransactionEvent(processedRootSpanJson));
|
||||
}
|
||||
|
||||
// process child spans
|
||||
if (processedEvent.spans) {
|
||||
const processedSpans = [];
|
||||
for (const span of processedEvent.spans) {
|
||||
const processedSpan = beforeSendSpan(span);
|
||||
if (!processedSpan) {
|
||||
spanUtils.showSpanDropWarning();
|
||||
processedSpans.push(span);
|
||||
} else {
|
||||
processedSpans.push(processedSpan);
|
||||
}
|
||||
}
|
||||
processedEvent.spans = processedSpans;
|
||||
}
|
||||
}
|
||||
|
||||
if (beforeSendTransaction) {
|
||||
if (processedEvent.spans) {
|
||||
// We store the # of spans before processing in SDK metadata,
|
||||
// so we can compare it afterwards to determine how many spans were dropped
|
||||
const spanCountBefore = processedEvent.spans.length;
|
||||
processedEvent.sdkProcessingMetadata = {
|
||||
...event.sdkProcessingMetadata,
|
||||
spanCountBeforeProcessing: spanCountBefore,
|
||||
};
|
||||
}
|
||||
return beforeSendTransaction(processedEvent , hint);
|
||||
}
|
||||
}
|
||||
|
||||
return processedEvent;
|
||||
}
|
||||
|
||||
function isErrorEvent(event) {
|
||||
return event.type === undefined;
|
||||
}
|
||||
|
||||
function isTransactionEvent(event) {
|
||||
return event.type === 'transaction';
|
||||
}
|
||||
|
||||
/** Extract trace information from scope */
|
||||
function _getTraceInfoFromScope(
|
||||
client,
|
||||
scope,
|
||||
) {
|
||||
if (!scope) {
|
||||
return [undefined, undefined];
|
||||
}
|
||||
|
||||
return currentScopes.withScope(scope, () => {
|
||||
const span = spanUtils.getActiveSpan();
|
||||
const traceContext = span ? spanUtils.spanToTraceContext(span) : currentScopes.getTraceContextFromScope(scope);
|
||||
const dynamicSamplingContext$1 = span
|
||||
? dynamicSamplingContext.getDynamicSamplingContextFromSpan(span)
|
||||
: dynamicSamplingContext.getDynamicSamplingContextFromScope(client, scope);
|
||||
return [dynamicSamplingContext$1, traceContext];
|
||||
});
|
||||
}
|
||||
|
||||
exports.BaseClient = BaseClient;
|
||||
exports.Client = Client;
|
||||
exports._getTraceInfoFromScope = _getTraceInfoFromScope;
|
||||
//# sourceMappingURL=client.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/client.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/client.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
6
dev/env/node_modules/@sentry/core/build/cjs/constants.js
generated
vendored
Executable file
6
dev/env/node_modules/@sentry/core/build/cjs/constants.js
generated
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const DEFAULT_ENVIRONMENT = 'production';
|
||||
|
||||
exports.DEFAULT_ENVIRONMENT = DEFAULT_ENVIRONMENT;
|
||||
//# sourceMappingURL=constants.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/constants.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/constants.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"constants.js","sources":["../../src/constants.ts"],"sourcesContent":["export const DEFAULT_ENVIRONMENT = 'production';\n"],"names":[],"mappings":";;AAAO,MAAM,mBAAA,GAAsB;;;;"}
|
||||
133
dev/env/node_modules/@sentry/core/build/cjs/currentScopes.js
generated
vendored
Executable file
133
dev/env/node_modules/@sentry/core/build/cjs/currentScopes.js
generated
vendored
Executable file
@@ -0,0 +1,133 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const index = require('./asyncContext/index.js');
|
||||
const carrier = require('./carrier.js');
|
||||
const scope = require('./scope.js');
|
||||
const propagationContext = require('./utils/propagationContext.js');
|
||||
|
||||
/**
|
||||
* Get the currently active scope.
|
||||
*/
|
||||
function getCurrentScope() {
|
||||
const carrier$1 = carrier.getMainCarrier();
|
||||
const acs = index.getAsyncContextStrategy(carrier$1);
|
||||
return acs.getCurrentScope();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently active isolation scope.
|
||||
* The isolation scope is active for the current execution context.
|
||||
*/
|
||||
function getIsolationScope() {
|
||||
const carrier$1 = carrier.getMainCarrier();
|
||||
const acs = index.getAsyncContextStrategy(carrier$1);
|
||||
return acs.getIsolationScope();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the global scope.
|
||||
* This scope is applied to _all_ events.
|
||||
*/
|
||||
function getGlobalScope() {
|
||||
return carrier.getGlobalSingleton('globalScope', () => new scope.Scope());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new scope with and executes the given operation within.
|
||||
* The scope is automatically removed once the operation
|
||||
* finishes or throws.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Either creates a new active scope, or sets the given scope as active scope in the given callback.
|
||||
*/
|
||||
function withScope(
|
||||
...rest
|
||||
) {
|
||||
const carrier$1 = carrier.getMainCarrier();
|
||||
const acs = index.getAsyncContextStrategy(carrier$1);
|
||||
|
||||
// If a scope is defined, we want to make this the active scope instead of the default one
|
||||
if (rest.length === 2) {
|
||||
const [scope, callback] = rest;
|
||||
|
||||
if (!scope) {
|
||||
return acs.withScope(callback);
|
||||
}
|
||||
|
||||
return acs.withSetScope(scope, callback);
|
||||
}
|
||||
|
||||
return acs.withScope(rest[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to fork the current isolation scope and the current scope based on the current async context strategy. If no
|
||||
* async context strategy is set, the isolation scope and the current scope will not be forked (this is currently the
|
||||
* case, for example, in the browser).
|
||||
*
|
||||
* Usage of this function in environments without async context strategy is discouraged and may lead to unexpected behaviour.
|
||||
*
|
||||
* This function is intended for Sentry SDK and SDK integration development. It is not recommended to be used in "normal"
|
||||
* applications directly because it comes with pitfalls. Use at your own risk!
|
||||
*/
|
||||
|
||||
/**
|
||||
* Either creates a new active isolation scope, or sets the given isolation scope as active scope in the given callback.
|
||||
*/
|
||||
function withIsolationScope(
|
||||
...rest
|
||||
|
||||
) {
|
||||
const carrier$1 = carrier.getMainCarrier();
|
||||
const acs = index.getAsyncContextStrategy(carrier$1);
|
||||
|
||||
// If a scope is defined, we want to make this the active scope instead of the default one
|
||||
if (rest.length === 2) {
|
||||
const [isolationScope, callback] = rest;
|
||||
|
||||
if (!isolationScope) {
|
||||
return acs.withIsolationScope(callback);
|
||||
}
|
||||
|
||||
return acs.withSetIsolationScope(isolationScope, callback);
|
||||
}
|
||||
|
||||
return acs.withIsolationScope(rest[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the currently active client.
|
||||
*/
|
||||
function getClient() {
|
||||
return getCurrentScope().getClient();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a trace context for the given scope.
|
||||
*/
|
||||
function getTraceContextFromScope(scope) {
|
||||
const propagationContext$1 = scope.getPropagationContext();
|
||||
|
||||
const { traceId, parentSpanId, propagationSpanId } = propagationContext$1;
|
||||
|
||||
const traceContext = {
|
||||
trace_id: traceId,
|
||||
span_id: propagationSpanId || propagationContext.generateSpanId(),
|
||||
};
|
||||
|
||||
if (parentSpanId) {
|
||||
traceContext.parent_span_id = parentSpanId;
|
||||
}
|
||||
|
||||
return traceContext;
|
||||
}
|
||||
|
||||
exports.getClient = getClient;
|
||||
exports.getCurrentScope = getCurrentScope;
|
||||
exports.getGlobalScope = getGlobalScope;
|
||||
exports.getIsolationScope = getIsolationScope;
|
||||
exports.getTraceContextFromScope = getTraceContextFromScope;
|
||||
exports.withIsolationScope = withIsolationScope;
|
||||
exports.withScope = withScope;
|
||||
//# sourceMappingURL=currentScopes.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/currentScopes.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/currentScopes.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
11
dev/env/node_modules/@sentry/core/build/cjs/debug-build.js
generated
vendored
Executable file
11
dev/env/node_modules/@sentry/core/build/cjs/debug-build.js
generated
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
/**
|
||||
* This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.
|
||||
*
|
||||
* ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.
|
||||
*/
|
||||
const DEBUG_BUILD = (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__);
|
||||
|
||||
exports.DEBUG_BUILD = DEBUG_BUILD;
|
||||
//# sourceMappingURL=debug-build.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/debug-build.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/debug-build.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"debug-build.js","sources":["../../src/debug-build.ts"],"sourcesContent":["declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n"],"names":[],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACO,MAAM,WAAA,IAAc,OAAA,gBAAA,KAAA,WAAA,IAAA,gBAAA;;;;"}
|
||||
18
dev/env/node_modules/@sentry/core/build/cjs/defaultScopes.js
generated
vendored
Executable file
18
dev/env/node_modules/@sentry/core/build/cjs/defaultScopes.js
generated
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const carrier = require('./carrier.js');
|
||||
const scope = require('./scope.js');
|
||||
|
||||
/** Get the default current scope. */
|
||||
function getDefaultCurrentScope() {
|
||||
return carrier.getGlobalSingleton('defaultCurrentScope', () => new scope.Scope());
|
||||
}
|
||||
|
||||
/** Get the default isolation scope. */
|
||||
function getDefaultIsolationScope() {
|
||||
return carrier.getGlobalSingleton('defaultIsolationScope', () => new scope.Scope());
|
||||
}
|
||||
|
||||
exports.getDefaultCurrentScope = getDefaultCurrentScope;
|
||||
exports.getDefaultIsolationScope = getDefaultIsolationScope;
|
||||
//# sourceMappingURL=defaultScopes.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/defaultScopes.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/defaultScopes.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"defaultScopes.js","sources":["../../src/defaultScopes.ts"],"sourcesContent":["import { getGlobalSingleton } from './carrier';\nimport { Scope } from './scope';\n\n/** Get the default current scope. */\nexport function getDefaultCurrentScope(): Scope {\n return getGlobalSingleton('defaultCurrentScope', () => new Scope());\n}\n\n/** Get the default isolation scope. */\nexport function getDefaultIsolationScope(): Scope {\n return getGlobalSingleton('defaultIsolationScope', () => new Scope());\n}\n"],"names":["getGlobalSingleton","Scope"],"mappings":";;;;;AAGA;AACO,SAAS,sBAAsB,GAAU;AAChD,EAAE,OAAOA,0BAAkB,CAAC,qBAAqB,EAAE,MAAM,IAAIC,WAAK,EAAE,CAAC;AACrE;;AAEA;AACO,SAAS,wBAAwB,GAAU;AAClD,EAAE,OAAOD,0BAAkB,CAAC,uBAAuB,EAAE,MAAM,IAAIC,WAAK,EAAE,CAAC;AACvE;;;;;"}
|
||||
131
dev/env/node_modules/@sentry/core/build/cjs/envelope.js
generated
vendored
Executable file
131
dev/env/node_modules/@sentry/core/build/cjs/envelope.js
generated
vendored
Executable file
@@ -0,0 +1,131 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const dynamicSamplingContext = require('./tracing/dynamicSamplingContext.js');
|
||||
const dsn = require('./utils/dsn.js');
|
||||
const envelope = require('./utils/envelope.js');
|
||||
const spanUtils = require('./utils/spanUtils.js');
|
||||
|
||||
/**
|
||||
* Apply SdkInfo (name, version, packages, integrations) to the corresponding event key.
|
||||
* Merge with existing data if any.
|
||||
**/
|
||||
function enhanceEventWithSdkInfo(event, sdkInfo) {
|
||||
if (!sdkInfo) {
|
||||
return event;
|
||||
}
|
||||
event.sdk = event.sdk || {};
|
||||
event.sdk.name = event.sdk.name || sdkInfo.name;
|
||||
event.sdk.version = event.sdk.version || sdkInfo.version;
|
||||
event.sdk.integrations = [...(event.sdk.integrations || []), ...(sdkInfo.integrations || [])];
|
||||
event.sdk.packages = [...(event.sdk.packages || []), ...(sdkInfo.packages || [])];
|
||||
return event;
|
||||
}
|
||||
|
||||
/** Creates an envelope from a Session */
|
||||
function createSessionEnvelope(
|
||||
session,
|
||||
dsn$1,
|
||||
metadata,
|
||||
tunnel,
|
||||
) {
|
||||
const sdkInfo = envelope.getSdkMetadataForEnvelopeHeader(metadata);
|
||||
const envelopeHeaders = {
|
||||
sent_at: new Date().toISOString(),
|
||||
...(sdkInfo && { sdk: sdkInfo }),
|
||||
...(!!tunnel && dsn$1 && { dsn: dsn.dsnToString(dsn$1) }),
|
||||
};
|
||||
|
||||
const envelopeItem =
|
||||
'aggregates' in session ? [{ type: 'sessions' }, session] : [{ type: 'session' }, session.toJSON()];
|
||||
|
||||
return envelope.createEnvelope(envelopeHeaders, [envelopeItem]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an Envelope from an event.
|
||||
*/
|
||||
function createEventEnvelope(
|
||||
event,
|
||||
dsn,
|
||||
metadata,
|
||||
tunnel,
|
||||
) {
|
||||
const sdkInfo = envelope.getSdkMetadataForEnvelopeHeader(metadata);
|
||||
|
||||
/*
|
||||
Note: Due to TS, event.type may be `replay_event`, theoretically.
|
||||
In practice, we never call `createEventEnvelope` with `replay_event` type,
|
||||
and we'd have to adjust a looot of types to make this work properly.
|
||||
We want to avoid casting this around, as that could lead to bugs (e.g. when we add another type)
|
||||
So the safe choice is to really guard against the replay_event type here.
|
||||
*/
|
||||
const eventType = event.type && event.type !== 'replay_event' ? event.type : 'event';
|
||||
|
||||
enhanceEventWithSdkInfo(event, metadata?.sdk);
|
||||
|
||||
const envelopeHeaders = envelope.createEventEnvelopeHeaders(event, sdkInfo, tunnel, dsn);
|
||||
|
||||
// Prevent this data (which, if it exists, was used in earlier steps in the processing pipeline) from being sent to
|
||||
// sentry. (Note: Our use of this property comes and goes with whatever we might be debugging, whatever hacks we may
|
||||
// have temporarily added, etc. Even if we don't happen to be using it at some point in the future, let's not get rid
|
||||
// of this `delete`, lest we miss putting it back in the next time the property is in use.)
|
||||
delete event.sdkProcessingMetadata;
|
||||
|
||||
const eventItem = [{ type: eventType }, event];
|
||||
return envelope.createEnvelope(envelopeHeaders, [eventItem]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create envelope from Span item.
|
||||
*
|
||||
* Takes an optional client and runs spans through `beforeSendSpan` if available.
|
||||
*/
|
||||
function createSpanEnvelope(spans, client) {
|
||||
function dscHasRequiredProps(dsc) {
|
||||
return !!dsc.trace_id && !!dsc.public_key;
|
||||
}
|
||||
|
||||
// For the moment we'll obtain the DSC from the first span in the array
|
||||
// This might need to be changed if we permit sending multiple spans from
|
||||
// different segments in one envelope
|
||||
const dsc = dynamicSamplingContext.getDynamicSamplingContextFromSpan(spans[0]);
|
||||
|
||||
const dsn$1 = client?.getDsn();
|
||||
const tunnel = client?.getOptions().tunnel;
|
||||
|
||||
const headers = {
|
||||
sent_at: new Date().toISOString(),
|
||||
...(dscHasRequiredProps(dsc) && { trace: dsc }),
|
||||
...(!!tunnel && dsn$1 && { dsn: dsn.dsnToString(dsn$1) }),
|
||||
};
|
||||
|
||||
const beforeSendSpan = client?.getOptions().beforeSendSpan;
|
||||
const convertToSpanJSON = beforeSendSpan
|
||||
? (span) => {
|
||||
const spanJson = spanUtils.spanToJSON(span);
|
||||
const processedSpan = beforeSendSpan(spanJson);
|
||||
|
||||
if (!processedSpan) {
|
||||
spanUtils.showSpanDropWarning();
|
||||
return spanJson;
|
||||
}
|
||||
|
||||
return processedSpan;
|
||||
}
|
||||
: spanUtils.spanToJSON;
|
||||
|
||||
const items = [];
|
||||
for (const span of spans) {
|
||||
const spanJson = convertToSpanJSON(span);
|
||||
if (spanJson) {
|
||||
items.push(envelope.createSpanEnvelopeItem(spanJson));
|
||||
}
|
||||
}
|
||||
|
||||
return envelope.createEnvelope(headers, items);
|
||||
}
|
||||
|
||||
exports.createEventEnvelope = createEventEnvelope;
|
||||
exports.createSessionEnvelope = createSessionEnvelope;
|
||||
exports.createSpanEnvelope = createSpanEnvelope;
|
||||
//# sourceMappingURL=envelope.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/envelope.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/envelope.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
40
dev/env/node_modules/@sentry/core/build/cjs/eventProcessors.js
generated
vendored
Executable file
40
dev/env/node_modules/@sentry/core/build/cjs/eventProcessors.js
generated
vendored
Executable file
@@ -0,0 +1,40 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const debugBuild = require('./debug-build.js');
|
||||
const debugLogger = require('./utils/debug-logger.js');
|
||||
const is = require('./utils/is.js');
|
||||
const syncpromise = require('./utils/syncpromise.js');
|
||||
|
||||
/**
|
||||
* Process an array of event processors, returning the processed event (or `null` if the event was dropped).
|
||||
*/
|
||||
function notifyEventProcessors(
|
||||
processors,
|
||||
event,
|
||||
hint,
|
||||
index = 0,
|
||||
) {
|
||||
return new syncpromise.SyncPromise((resolve, reject) => {
|
||||
const processor = processors[index];
|
||||
if (event === null || typeof processor !== 'function') {
|
||||
resolve(event);
|
||||
} else {
|
||||
const result = processor({ ...event }, hint) ;
|
||||
|
||||
debugBuild.DEBUG_BUILD && processor.id && result === null && debugLogger.debug.log(`Event processor "${processor.id}" dropped event`);
|
||||
|
||||
if (is.isThenable(result)) {
|
||||
void result
|
||||
.then(final => notifyEventProcessors(processors, final, hint, index + 1).then(resolve))
|
||||
.then(null, reject);
|
||||
} else {
|
||||
void notifyEventProcessors(processors, result, hint, index + 1)
|
||||
.then(resolve)
|
||||
.then(null, reject);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
exports.notifyEventProcessors = notifyEventProcessors;
|
||||
//# sourceMappingURL=eventProcessors.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/eventProcessors.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/eventProcessors.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"eventProcessors.js","sources":["../../src/eventProcessors.ts"],"sourcesContent":["import { DEBUG_BUILD } from './debug-build';\nimport type { Event, EventHint } from './types-hoist/event';\nimport type { EventProcessor } from './types-hoist/eventprocessor';\nimport { debug } from './utils/debug-logger';\nimport { isThenable } from './utils/is';\nimport { SyncPromise } from './utils/syncpromise';\n\n/**\n * Process an array of event processors, returning the processed event (or `null` if the event was dropped).\n */\nexport function notifyEventProcessors(\n processors: EventProcessor[],\n event: Event | null,\n hint: EventHint,\n index: number = 0,\n): PromiseLike<Event | null> {\n return new SyncPromise<Event | null>((resolve, reject) => {\n const processor = processors[index];\n if (event === null || typeof processor !== 'function') {\n resolve(event);\n } else {\n const result = processor({ ...event }, hint) as Event | null;\n\n DEBUG_BUILD && processor.id && result === null && debug.log(`Event processor \"${processor.id}\" dropped event`);\n\n if (isThenable(result)) {\n void result\n .then(final => notifyEventProcessors(processors, final, hint, index + 1).then(resolve))\n .then(null, reject);\n } else {\n void notifyEventProcessors(processors, result, hint, index + 1)\n .then(resolve)\n .then(null, reject);\n }\n }\n });\n}\n"],"names":["SyncPromise","DEBUG_BUILD","debug","isThenable"],"mappings":";;;;;;;AAOA;AACA;AACA;AACO,SAAS,qBAAqB;AACrC,EAAE,UAAU;AACZ,EAAE,KAAK;AACP,EAAE,IAAI;AACN,EAAE,KAAK,GAAW,CAAC;AACnB,EAA6B;AAC7B,EAAE,OAAO,IAAIA,uBAAW,CAAe,CAAC,OAAO,EAAE,MAAM,KAAK;AAC5D,IAAI,MAAM,SAAA,GAAY,UAAU,CAAC,KAAK,CAAC;AACvC,IAAI,IAAI,KAAA,KAAU,IAAA,IAAQ,OAAO,SAAA,KAAc,UAAU,EAAE;AAC3D,MAAM,OAAO,CAAC,KAAK,CAAC;AACpB,WAAW;AACX,MAAM,MAAM,MAAA,GAAS,SAAS,CAAC,EAAE,GAAG,KAAA,EAAO,EAAE,IAAI,CAAA;;AAEjD,MAAMC,sBAAA,IAAe,SAAS,CAAC,MAAM,MAAA,KAAW,IAAA,IAAQC,iBAAK,CAAC,GAAG,CAAC,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;;AAEpH,MAAM,IAAIC,aAAU,CAAC,MAAM,CAAC,EAAE;AAC9B,QAAQ,KAAK;AACb,WAAW,IAAI,CAAC,KAAA,IAAS,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;AAChG,WAAW,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;AAC7B,aAAa;AACb,QAAQ,KAAK,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,KAAA,GAAQ,CAAC;AACtE,WAAW,IAAI,CAAC,OAAO;AACvB,WAAW,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;AAC7B;AACA;AACA,GAAG,CAAC;AACJ;;;;"}
|
||||
344
dev/env/node_modules/@sentry/core/build/cjs/exports.js
generated
vendored
Executable file
344
dev/env/node_modules/@sentry/core/build/cjs/exports.js
generated
vendored
Executable file
@@ -0,0 +1,344 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('./currentScopes.js');
|
||||
const debugBuild = require('./debug-build.js');
|
||||
const session = require('./session.js');
|
||||
const debugLogger = require('./utils/debug-logger.js');
|
||||
const is = require('./utils/is.js');
|
||||
const misc = require('./utils/misc.js');
|
||||
const prepareEvent = require('./utils/prepareEvent.js');
|
||||
const time = require('./utils/time.js');
|
||||
const worldwide = require('./utils/worldwide.js');
|
||||
|
||||
/**
|
||||
* Captures an exception event and sends it to Sentry.
|
||||
*
|
||||
* @param exception The exception to capture.
|
||||
* @param hint Optional additional data to attach to the Sentry event.
|
||||
* @returns the id of the captured Sentry event.
|
||||
*/
|
||||
function captureException(exception, hint) {
|
||||
return currentScopes.getCurrentScope().captureException(exception, prepareEvent.parseEventHintOrCaptureContext(hint));
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures a message event and sends it to Sentry.
|
||||
*
|
||||
* @param message The message to send to Sentry.
|
||||
* @param captureContext Define the level of the message or pass in additional data to attach to the message.
|
||||
* @returns the id of the captured message.
|
||||
*/
|
||||
function captureMessage(message, captureContext) {
|
||||
// This is necessary to provide explicit scopes upgrade, without changing the original
|
||||
// arity of the `captureMessage(message, level)` method.
|
||||
const level = typeof captureContext === 'string' ? captureContext : undefined;
|
||||
const context = typeof captureContext !== 'string' ? { captureContext } : undefined;
|
||||
return currentScopes.getCurrentScope().captureMessage(message, level, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures a manually created event and sends it to Sentry.
|
||||
*
|
||||
* @param event The event to send to Sentry.
|
||||
* @param hint Optional additional data to attach to the Sentry event.
|
||||
* @returns the id of the captured event.
|
||||
*/
|
||||
function captureEvent(event, hint) {
|
||||
return currentScopes.getCurrentScope().captureEvent(event, hint);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets context data with the given name.
|
||||
* @param name of the context
|
||||
* @param context Any kind of data. This data will be normalized.
|
||||
*/
|
||||
function setContext(name, context) {
|
||||
currentScopes.getIsolationScope().setContext(name, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an object that will be merged sent as extra data with the event.
|
||||
* @param extras Extras object to merge into current context.
|
||||
*/
|
||||
function setExtras(extras) {
|
||||
currentScopes.getIsolationScope().setExtras(extras);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set key:value that will be sent as extra data with the event.
|
||||
* @param key String of extra
|
||||
* @param extra Any kind of data. This data will be normalized.
|
||||
*/
|
||||
function setExtra(key, extra) {
|
||||
currentScopes.getIsolationScope().setExtra(key, extra);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an object that will be merged sent as tags data with the event.
|
||||
* @param tags Tags context object to merge into current context.
|
||||
*/
|
||||
function setTags(tags) {
|
||||
currentScopes.getIsolationScope().setTags(tags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set key:value that will be sent as tags data with the event.
|
||||
*
|
||||
* Can also be used to unset a tag, by passing `undefined`.
|
||||
*
|
||||
* @param key String key of tag
|
||||
* @param value Value of tag
|
||||
*/
|
||||
function setTag(key, value) {
|
||||
currentScopes.getIsolationScope().setTag(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates user context information for future events.
|
||||
*
|
||||
* @param user User context object to be set in the current context. Pass `null` to unset the user.
|
||||
*/
|
||||
function setUser(user) {
|
||||
currentScopes.getIsolationScope().setUser(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* The last error event id of the isolation scope.
|
||||
*
|
||||
* Warning: This function really returns the last recorded error event id on the current
|
||||
* isolation scope. If you call this function after handling a certain error and another error
|
||||
* is captured in between, the last one is returned instead of the one you might expect.
|
||||
* Also, ids of events that were never sent to Sentry (for example because
|
||||
* they were dropped in `beforeSend`) could be returned.
|
||||
*
|
||||
* @returns The last event id of the isolation scope.
|
||||
*/
|
||||
function lastEventId() {
|
||||
return currentScopes.getIsolationScope().lastEventId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a cron monitor check in and send it to Sentry.
|
||||
*
|
||||
* @param checkIn An object that describes a check in.
|
||||
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
|
||||
* to create a monitor automatically when sending a check in.
|
||||
*/
|
||||
function captureCheckIn(checkIn, upsertMonitorConfig) {
|
||||
const scope = currentScopes.getCurrentScope();
|
||||
const client = currentScopes.getClient();
|
||||
if (!client) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('Cannot capture check-in. No client defined.');
|
||||
} else if (!client.captureCheckIn) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('Cannot capture check-in. Client does not support sending check-ins.');
|
||||
} else {
|
||||
return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);
|
||||
}
|
||||
|
||||
return misc.uuid4();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.
|
||||
*
|
||||
* @param monitorSlug The distinct slug of the monitor.
|
||||
* @param callback Callback to be monitored
|
||||
* @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want
|
||||
* to create a monitor automatically when sending a check in.
|
||||
*/
|
||||
function withMonitor(
|
||||
monitorSlug,
|
||||
callback,
|
||||
upsertMonitorConfig,
|
||||
) {
|
||||
const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);
|
||||
const now = time.timestampInSeconds();
|
||||
|
||||
function finishCheckIn(status) {
|
||||
captureCheckIn({ monitorSlug, status, checkInId, duration: time.timestampInSeconds() - now });
|
||||
}
|
||||
|
||||
return currentScopes.withIsolationScope(() => {
|
||||
let maybePromiseResult;
|
||||
try {
|
||||
maybePromiseResult = callback();
|
||||
} catch (e) {
|
||||
finishCheckIn('error');
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (is.isThenable(maybePromiseResult)) {
|
||||
return maybePromiseResult.then(
|
||||
r => {
|
||||
finishCheckIn('ok');
|
||||
return r;
|
||||
},
|
||||
e => {
|
||||
finishCheckIn('error');
|
||||
throw e;
|
||||
},
|
||||
) ;
|
||||
}
|
||||
finishCheckIn('ok');
|
||||
|
||||
return maybePromiseResult;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Call `flush()` on the current client, if there is one. See {@link Client.flush}.
|
||||
*
|
||||
* @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause
|
||||
* the client to wait until all events are sent before resolving the promise.
|
||||
* @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
|
||||
* doesn't (or if there's no client defined).
|
||||
*/
|
||||
async function flush(timeout) {
|
||||
const client = currentScopes.getClient();
|
||||
if (client) {
|
||||
return client.flush(timeout);
|
||||
}
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('Cannot flush events. No client defined.');
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call `close()` on the current client, if there is one. See {@link Client.close}.
|
||||
*
|
||||
* @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this
|
||||
* parameter will cause the client to wait until all events are sent before disabling itself.
|
||||
* @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it
|
||||
* doesn't (or if there's no client defined).
|
||||
*/
|
||||
async function close(timeout) {
|
||||
const client = currentScopes.getClient();
|
||||
if (client) {
|
||||
return client.close(timeout);
|
||||
}
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('Cannot flush events and disable SDK. No client defined.');
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if Sentry has been properly initialized.
|
||||
*/
|
||||
function isInitialized() {
|
||||
return !!currentScopes.getClient();
|
||||
}
|
||||
|
||||
/** If the SDK is initialized & enabled. */
|
||||
function isEnabled() {
|
||||
const client = currentScopes.getClient();
|
||||
return client?.getOptions().enabled !== false && !!client?.getTransport();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an event processor.
|
||||
* This will be added to the current isolation scope, ensuring any event that is processed in the current execution
|
||||
* context will have the processor applied.
|
||||
*/
|
||||
function addEventProcessor(callback) {
|
||||
currentScopes.getIsolationScope().addEventProcessor(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a session on the current isolation scope.
|
||||
*
|
||||
* @param context (optional) additional properties to be applied to the returned session object
|
||||
*
|
||||
* @returns the new active session
|
||||
*/
|
||||
function startSession(context) {
|
||||
const isolationScope = currentScopes.getIsolationScope();
|
||||
const currentScope = currentScopes.getCurrentScope();
|
||||
|
||||
// Will fetch userAgent if called from browser sdk
|
||||
const { userAgent } = worldwide.GLOBAL_OBJ.navigator || {};
|
||||
|
||||
const session$1 = session.makeSession({
|
||||
user: currentScope.getUser() || isolationScope.getUser(),
|
||||
...(userAgent && { userAgent }),
|
||||
...context,
|
||||
});
|
||||
|
||||
// End existing session if there's one
|
||||
const currentSession = isolationScope.getSession();
|
||||
if (currentSession?.status === 'ok') {
|
||||
session.updateSession(currentSession, { status: 'exited' });
|
||||
}
|
||||
|
||||
endSession();
|
||||
|
||||
// Afterwards we set the new session on the scope
|
||||
isolationScope.setSession(session$1);
|
||||
|
||||
return session$1;
|
||||
}
|
||||
|
||||
/**
|
||||
* End the session on the current isolation scope.
|
||||
*/
|
||||
function endSession() {
|
||||
const isolationScope = currentScopes.getIsolationScope();
|
||||
const currentScope = currentScopes.getCurrentScope();
|
||||
|
||||
const session$1 = currentScope.getSession() || isolationScope.getSession();
|
||||
if (session$1) {
|
||||
session.closeSession(session$1);
|
||||
}
|
||||
_sendSessionUpdate();
|
||||
|
||||
// the session is over; take it off of the scope
|
||||
isolationScope.setSession();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the current Session on the scope
|
||||
*/
|
||||
function _sendSessionUpdate() {
|
||||
const isolationScope = currentScopes.getIsolationScope();
|
||||
const client = currentScopes.getClient();
|
||||
const session = isolationScope.getSession();
|
||||
if (session && client) {
|
||||
client.captureSession(session);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends the current session on the scope to Sentry
|
||||
*
|
||||
* @param end If set the session will be marked as exited and removed from the scope.
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
function captureSession(end = false) {
|
||||
// both send the update and pull the session from the scope
|
||||
if (end) {
|
||||
endSession();
|
||||
return;
|
||||
}
|
||||
|
||||
// only send the update
|
||||
_sendSessionUpdate();
|
||||
}
|
||||
|
||||
exports.addEventProcessor = addEventProcessor;
|
||||
exports.captureCheckIn = captureCheckIn;
|
||||
exports.captureEvent = captureEvent;
|
||||
exports.captureException = captureException;
|
||||
exports.captureMessage = captureMessage;
|
||||
exports.captureSession = captureSession;
|
||||
exports.close = close;
|
||||
exports.endSession = endSession;
|
||||
exports.flush = flush;
|
||||
exports.isEnabled = isEnabled;
|
||||
exports.isInitialized = isInitialized;
|
||||
exports.lastEventId = lastEventId;
|
||||
exports.setContext = setContext;
|
||||
exports.setExtra = setExtra;
|
||||
exports.setExtras = setExtras;
|
||||
exports.setTag = setTag;
|
||||
exports.setTags = setTags;
|
||||
exports.setUser = setUser;
|
||||
exports.startSession = startSession;
|
||||
exports.withMonitor = withMonitor;
|
||||
//# sourceMappingURL=exports.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/exports.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/exports.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
43
dev/env/node_modules/@sentry/core/build/cjs/feedback.js
generated
vendored
Executable file
43
dev/env/node_modules/@sentry/core/build/cjs/feedback.js
generated
vendored
Executable file
@@ -0,0 +1,43 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('./currentScopes.js');
|
||||
|
||||
/**
|
||||
* Send user feedback to Sentry.
|
||||
*/
|
||||
function captureFeedback(
|
||||
params,
|
||||
hint = {},
|
||||
scope = currentScopes.getCurrentScope(),
|
||||
) {
|
||||
const { message, name, email, url, source, associatedEventId, tags } = params;
|
||||
|
||||
const feedbackEvent = {
|
||||
contexts: {
|
||||
feedback: {
|
||||
contact_email: email,
|
||||
name,
|
||||
message,
|
||||
url,
|
||||
source,
|
||||
associated_event_id: associatedEventId,
|
||||
},
|
||||
},
|
||||
type: 'feedback',
|
||||
level: 'info',
|
||||
tags,
|
||||
};
|
||||
|
||||
const client = scope?.getClient() || currentScopes.getClient();
|
||||
|
||||
if (client) {
|
||||
client.emit('beforeSendFeedback', feedbackEvent, hint);
|
||||
}
|
||||
|
||||
const eventId = scope.captureEvent(feedbackEvent, hint);
|
||||
|
||||
return eventId;
|
||||
}
|
||||
|
||||
exports.captureFeedback = captureFeedback;
|
||||
//# sourceMappingURL=feedback.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/feedback.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/feedback.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"feedback.js","sources":["../../src/feedback.ts"],"sourcesContent":["import { getClient, getCurrentScope } from './currentScopes';\nimport type { EventHint } from './types-hoist/event';\nimport type { FeedbackEvent, SendFeedbackParams } from './types-hoist/feedback';\n\n/**\n * Send user feedback to Sentry.\n */\nexport function captureFeedback(\n params: SendFeedbackParams,\n hint: EventHint & { includeReplay?: boolean } = {},\n scope = getCurrentScope(),\n): string {\n const { message, name, email, url, source, associatedEventId, tags } = params;\n\n const feedbackEvent: FeedbackEvent = {\n contexts: {\n feedback: {\n contact_email: email,\n name,\n message,\n url,\n source,\n associated_event_id: associatedEventId,\n },\n },\n type: 'feedback',\n level: 'info',\n tags,\n };\n\n const client = scope?.getClient() || getClient();\n\n if (client) {\n client.emit('beforeSendFeedback', feedbackEvent, hint);\n }\n\n const eventId = scope.captureEvent(feedbackEvent, hint);\n\n return eventId;\n}\n"],"names":["getCurrentScope","getClient"],"mappings":";;;;AAIA;AACA;AACA;AACO,SAAS,eAAe;AAC/B,EAAE,MAAM;AACR,EAAE,IAAI,GAA4C,EAAE;AACpD,EAAE,KAAA,GAAQA,6BAAe,EAAE;AAC3B,EAAU;AACV,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,iBAAiB,EAAE,IAAA,EAAK,GAAI,MAAM;;AAE/E,EAAE,MAAM,aAAa,GAAkB;AACvC,IAAI,QAAQ,EAAE;AACd,MAAM,QAAQ,EAAE;AAChB,QAAQ,aAAa,EAAE,KAAK;AAC5B,QAAQ,IAAI;AACZ,QAAQ,OAAO;AACf,QAAQ,GAAG;AACX,QAAQ,MAAM;AACd,QAAQ,mBAAmB,EAAE,iBAAiB;AAC9C,OAAO;AACP,KAAK;AACL,IAAI,IAAI,EAAE,UAAU;AACpB,IAAI,KAAK,EAAE,MAAM;AACjB,IAAI,IAAI;AACR,GAAG;;AAEH,EAAE,MAAM,MAAA,GAAS,KAAK,EAAE,SAAS,EAAC,IAAKC,uBAAS,EAAE;;AAElD,EAAE,IAAI,MAAM,EAAE;AACd,IAAI,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,aAAa,EAAE,IAAI,CAAC;AAC1D;;AAEA,EAAE,MAAM,OAAA,GAAU,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,IAAI,CAAC;;AAEzD,EAAE,OAAO,OAAO;AAChB;;;;"}
|
||||
258
dev/env/node_modules/@sentry/core/build/cjs/fetch.js
generated
vendored
Executable file
258
dev/env/node_modules/@sentry/core/build/cjs/fetch.js
generated
vendored
Executable file
@@ -0,0 +1,258 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('./currentScopes.js');
|
||||
const semanticAttributes = require('./semanticAttributes.js');
|
||||
const spanUtils = require('./utils/spanUtils.js');
|
||||
const spanstatus = require('./tracing/spanstatus.js');
|
||||
const is = require('./utils/is.js');
|
||||
const hasSpansEnabled = require('./utils/hasSpansEnabled.js');
|
||||
const baggage = require('./utils/baggage.js');
|
||||
const sentryNonRecordingSpan = require('./tracing/sentryNonRecordingSpan.js');
|
||||
const trace = require('./tracing/trace.js');
|
||||
const traceData = require('./utils/traceData.js');
|
||||
const url = require('./utils/url.js');
|
||||
|
||||
/**
|
||||
* Create and track fetch request spans for usage in combination with `addFetchInstrumentationHandler`.
|
||||
*
|
||||
* @returns Span if a span was created, otherwise void.
|
||||
*/
|
||||
function instrumentFetchRequest(
|
||||
handlerData,
|
||||
shouldCreateSpan,
|
||||
shouldAttachHeaders,
|
||||
spans,
|
||||
spanOrigin = 'auto.http.browser',
|
||||
) {
|
||||
if (!handlerData.fetchData) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const { method, url } = handlerData.fetchData;
|
||||
|
||||
const shouldCreateSpanResult = hasSpansEnabled.hasSpansEnabled() && shouldCreateSpan(url);
|
||||
|
||||
if (handlerData.endTimestamp && shouldCreateSpanResult) {
|
||||
const spanId = handlerData.fetchData.__span;
|
||||
if (!spanId) return;
|
||||
|
||||
const span = spans[spanId];
|
||||
if (span) {
|
||||
endSpan(span, handlerData);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete spans[spanId];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const hasParent = !!spanUtils.getActiveSpan();
|
||||
|
||||
const span =
|
||||
shouldCreateSpanResult && hasParent
|
||||
? trace.startInactiveSpan(getSpanStartOptions(url, method, spanOrigin))
|
||||
: new sentryNonRecordingSpan.SentryNonRecordingSpan();
|
||||
|
||||
handlerData.fetchData.__span = span.spanContext().spanId;
|
||||
spans[span.spanContext().spanId] = span;
|
||||
|
||||
if (shouldAttachHeaders(handlerData.fetchData.url)) {
|
||||
const request = handlerData.args[0];
|
||||
|
||||
const options = handlerData.args[1] || {};
|
||||
|
||||
const headers = _addTracingHeadersToFetchRequest(
|
||||
request,
|
||||
options,
|
||||
// If performance is disabled (TWP) or there's no active root span (pageload/navigation/interaction),
|
||||
// we do not want to use the span as base for the trace headers,
|
||||
// which means that the headers will be generated from the scope and the sampling decision is deferred
|
||||
hasSpansEnabled.hasSpansEnabled() && hasParent ? span : undefined,
|
||||
);
|
||||
if (headers) {
|
||||
// Ensure this is actually set, if no options have been passed previously
|
||||
handlerData.args[1] = options;
|
||||
options.headers = headers;
|
||||
}
|
||||
}
|
||||
|
||||
const client = currentScopes.getClient();
|
||||
|
||||
if (client) {
|
||||
const fetchHint = {
|
||||
input: handlerData.args,
|
||||
response: handlerData.response,
|
||||
startTimestamp: handlerData.startTimestamp,
|
||||
endTimestamp: handlerData.endTimestamp,
|
||||
} ;
|
||||
|
||||
client.emit('beforeOutgoingRequestSpan', span, fetchHint);
|
||||
}
|
||||
|
||||
return span;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds sentry-trace and baggage headers to the various forms of fetch headers.
|
||||
* exported only for testing purposes
|
||||
*
|
||||
* When we determine if we should add a baggage header, there are 3 cases:
|
||||
* 1. No previous baggage header -> add baggage
|
||||
* 2. Previous baggage header has no sentry baggage values -> add our baggage
|
||||
* 3. Previous baggage header has sentry baggage values -> do nothing (might have been added manually by users)
|
||||
*/
|
||||
// eslint-disable-next-line complexity -- yup it's this complicated :(
|
||||
function _addTracingHeadersToFetchRequest(
|
||||
request,
|
||||
fetchOptionsObj
|
||||
|
||||
,
|
||||
span,
|
||||
) {
|
||||
const traceHeaders = traceData.getTraceData({ span });
|
||||
const sentryTrace = traceHeaders['sentry-trace'];
|
||||
const baggage = traceHeaders.baggage;
|
||||
|
||||
// Nothing to do, when we return undefined here, the original headers will be used
|
||||
if (!sentryTrace) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const originalHeaders = fetchOptionsObj.headers || (is.isRequest(request) ? request.headers : undefined);
|
||||
|
||||
if (!originalHeaders) {
|
||||
return { ...traceHeaders };
|
||||
} else if (isHeaders(originalHeaders)) {
|
||||
const newHeaders = new Headers(originalHeaders);
|
||||
|
||||
// We don't want to override manually added sentry headers
|
||||
if (!newHeaders.get('sentry-trace')) {
|
||||
newHeaders.set('sentry-trace', sentryTrace);
|
||||
}
|
||||
|
||||
if (baggage) {
|
||||
const prevBaggageHeader = newHeaders.get('baggage');
|
||||
|
||||
if (!prevBaggageHeader) {
|
||||
newHeaders.set('baggage', baggage);
|
||||
} else if (!baggageHeaderHasSentryBaggageValues(prevBaggageHeader)) {
|
||||
newHeaders.set('baggage', `${prevBaggageHeader},${baggage}`);
|
||||
}
|
||||
}
|
||||
|
||||
return newHeaders;
|
||||
} else if (Array.isArray(originalHeaders)) {
|
||||
const newHeaders = [...originalHeaders];
|
||||
|
||||
if (!originalHeaders.find(header => header[0] === 'sentry-trace')) {
|
||||
newHeaders.push(['sentry-trace', sentryTrace]);
|
||||
}
|
||||
|
||||
const prevBaggageHeaderWithSentryValues = originalHeaders.find(
|
||||
header => header[0] === 'baggage' && baggageHeaderHasSentryBaggageValues(header[1]),
|
||||
);
|
||||
|
||||
if (baggage && !prevBaggageHeaderWithSentryValues) {
|
||||
// If there are multiple entries with the same key, the browser will merge the values into a single request header.
|
||||
// Its therefore safe to simply push a "baggage" entry, even though there might already be another baggage header.
|
||||
newHeaders.push(['baggage', baggage]);
|
||||
}
|
||||
|
||||
return newHeaders ;
|
||||
} else {
|
||||
const existingSentryTraceHeader = 'sentry-trace' in originalHeaders ? originalHeaders['sentry-trace'] : undefined;
|
||||
|
||||
const existingBaggageHeader = 'baggage' in originalHeaders ? originalHeaders.baggage : undefined;
|
||||
const newBaggageHeaders = existingBaggageHeader
|
||||
? Array.isArray(existingBaggageHeader)
|
||||
? [...existingBaggageHeader]
|
||||
: [existingBaggageHeader]
|
||||
: [];
|
||||
|
||||
const prevBaggageHeaderWithSentryValues =
|
||||
existingBaggageHeader &&
|
||||
(Array.isArray(existingBaggageHeader)
|
||||
? existingBaggageHeader.find(headerItem => baggageHeaderHasSentryBaggageValues(headerItem))
|
||||
: baggageHeaderHasSentryBaggageValues(existingBaggageHeader));
|
||||
|
||||
if (baggage && !prevBaggageHeaderWithSentryValues) {
|
||||
newBaggageHeaders.push(baggage);
|
||||
}
|
||||
|
||||
return {
|
||||
...(originalHeaders ),
|
||||
'sentry-trace': (existingSentryTraceHeader ) ?? sentryTrace,
|
||||
baggage: newBaggageHeaders.length > 0 ? newBaggageHeaders.join(',') : undefined,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function endSpan(span, handlerData) {
|
||||
if (handlerData.response) {
|
||||
spanstatus.setHttpStatus(span, handlerData.response.status);
|
||||
|
||||
const contentLength = handlerData.response?.headers?.get('content-length');
|
||||
|
||||
if (contentLength) {
|
||||
const contentLengthNum = parseInt(contentLength);
|
||||
if (contentLengthNum > 0) {
|
||||
span.setAttribute('http.response_content_length', contentLengthNum);
|
||||
}
|
||||
}
|
||||
} else if (handlerData.error) {
|
||||
span.setStatus({ code: spanstatus.SPAN_STATUS_ERROR, message: 'internal_error' });
|
||||
}
|
||||
span.end();
|
||||
}
|
||||
|
||||
function baggageHeaderHasSentryBaggageValues(baggageHeader) {
|
||||
return baggageHeader.split(',').some(baggageEntry => baggageEntry.trim().startsWith(baggage.SENTRY_BAGGAGE_KEY_PREFIX));
|
||||
}
|
||||
|
||||
function isHeaders(headers) {
|
||||
return typeof Headers !== 'undefined' && is.isInstanceOf(headers, Headers);
|
||||
}
|
||||
|
||||
function getSpanStartOptions(
|
||||
url$1,
|
||||
method,
|
||||
spanOrigin,
|
||||
) {
|
||||
const parsedUrl = url.parseStringToURLObject(url$1);
|
||||
return {
|
||||
name: parsedUrl ? `${method} ${url.getSanitizedUrlStringFromUrlObject(parsedUrl)}` : method,
|
||||
attributes: getFetchSpanAttributes(url$1, parsedUrl, method, spanOrigin),
|
||||
};
|
||||
}
|
||||
|
||||
function getFetchSpanAttributes(
|
||||
url$1,
|
||||
parsedUrl,
|
||||
method,
|
||||
spanOrigin,
|
||||
) {
|
||||
const attributes = {
|
||||
url: url$1,
|
||||
type: 'fetch',
|
||||
'http.method': method,
|
||||
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: spanOrigin,
|
||||
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'http.client',
|
||||
};
|
||||
if (parsedUrl) {
|
||||
if (!url.isURLObjectRelative(parsedUrl)) {
|
||||
attributes['http.url'] = parsedUrl.href;
|
||||
attributes['server.address'] = parsedUrl.host;
|
||||
}
|
||||
if (parsedUrl.search) {
|
||||
attributes['http.query'] = parsedUrl.search;
|
||||
}
|
||||
if (parsedUrl.hash) {
|
||||
attributes['http.fragment'] = parsedUrl.hash;
|
||||
}
|
||||
}
|
||||
return attributes;
|
||||
}
|
||||
|
||||
exports._addTracingHeadersToFetchRequest = _addTracingHeadersToFetchRequest;
|
||||
exports.instrumentFetchRequest = instrumentFetchRequest;
|
||||
//# sourceMappingURL=fetch.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/fetch.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/fetch.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
438
dev/env/node_modules/@sentry/core/build/cjs/index.js
generated
vendored
Executable file
438
dev/env/node_modules/@sentry/core/build/cjs/index.js
generated
vendored
Executable file
@@ -0,0 +1,438 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const errors = require('./tracing/errors.js');
|
||||
const utils = require('./tracing/utils.js');
|
||||
const idleSpan = require('./tracing/idleSpan.js');
|
||||
const sentrySpan = require('./tracing/sentrySpan.js');
|
||||
const sentryNonRecordingSpan = require('./tracing/sentryNonRecordingSpan.js');
|
||||
const spanstatus = require('./tracing/spanstatus.js');
|
||||
const trace = require('./tracing/trace.js');
|
||||
const dynamicSamplingContext = require('./tracing/dynamicSamplingContext.js');
|
||||
const measurement = require('./tracing/measurement.js');
|
||||
const sampling = require('./tracing/sampling.js');
|
||||
const logSpans = require('./tracing/logSpans.js');
|
||||
const semanticAttributes = require('./semanticAttributes.js');
|
||||
const envelope = require('./envelope.js');
|
||||
const exports$1 = require('./exports.js');
|
||||
const currentScopes = require('./currentScopes.js');
|
||||
const defaultScopes = require('./defaultScopes.js');
|
||||
const index = require('./asyncContext/index.js');
|
||||
const carrier = require('./carrier.js');
|
||||
const session = require('./session.js');
|
||||
const scope = require('./scope.js');
|
||||
const eventProcessors = require('./eventProcessors.js');
|
||||
const api = require('./api.js');
|
||||
const client = require('./client.js');
|
||||
const serverRuntimeClient = require('./server-runtime-client.js');
|
||||
const sdk = require('./sdk.js');
|
||||
const base = require('./transports/base.js');
|
||||
const offline = require('./transports/offline.js');
|
||||
const multiplexed = require('./transports/multiplexed.js');
|
||||
const integration = require('./integration.js');
|
||||
const applyScopeDataToEvent = require('./utils/applyScopeDataToEvent.js');
|
||||
const prepareEvent = require('./utils/prepareEvent.js');
|
||||
const checkin = require('./checkin.js');
|
||||
const hasSpansEnabled = require('./utils/hasSpansEnabled.js');
|
||||
const isSentryRequestUrl = require('./utils/isSentryRequestUrl.js');
|
||||
const handleCallbackErrors = require('./utils/handleCallbackErrors.js');
|
||||
const parameterize = require('./utils/parameterize.js');
|
||||
const ipAddress = require('./utils/ipAddress.js');
|
||||
const spanUtils = require('./utils/spanUtils.js');
|
||||
const parseSampleRate = require('./utils/parseSampleRate.js');
|
||||
const sdkMetadata = require('./utils/sdkMetadata.js');
|
||||
const traceData = require('./utils/traceData.js');
|
||||
const meta = require('./utils/meta.js');
|
||||
const debounce = require('./utils/debounce.js');
|
||||
const request = require('./utils/request.js');
|
||||
const constants = require('./constants.js');
|
||||
const breadcrumbs = require('./breadcrumbs.js');
|
||||
const functiontostring = require('./integrations/functiontostring.js');
|
||||
const eventFilters = require('./integrations/eventFilters.js');
|
||||
const linkederrors = require('./integrations/linkederrors.js');
|
||||
const metadata = require('./integrations/metadata.js');
|
||||
const requestdata = require('./integrations/requestdata.js');
|
||||
const captureconsole = require('./integrations/captureconsole.js');
|
||||
const dedupe = require('./integrations/dedupe.js');
|
||||
const extraerrordata = require('./integrations/extraerrordata.js');
|
||||
const rewriteframes = require('./integrations/rewriteframes.js');
|
||||
const supabase = require('./integrations/supabase.js');
|
||||
const zoderrors = require('./integrations/zoderrors.js');
|
||||
const thirdPartyErrorsFilter = require('./integrations/third-party-errors-filter.js');
|
||||
const console = require('./integrations/console.js');
|
||||
const featureFlagsIntegration = require('./integrations/featureFlags/featureFlagsIntegration.js');
|
||||
const profiling = require('./profiling.js');
|
||||
const fetch = require('./fetch.js');
|
||||
const trpc = require('./trpc.js');
|
||||
const index$1 = require('./integrations/mcp-server/index.js');
|
||||
const feedback = require('./feedback.js');
|
||||
const exports$2 = require('./logs/exports.js');
|
||||
const consoleIntegration = require('./logs/console-integration.js');
|
||||
const vercelAi = require('./utils/vercel-ai.js');
|
||||
const index$2 = require('./utils/openai/index.js');
|
||||
const constants$1 = require('./utils/openai/constants.js');
|
||||
const featureFlags = require('./utils/featureFlags.js');
|
||||
const aggregateErrors = require('./utils/aggregate-errors.js');
|
||||
const breadcrumbLogLevel = require('./utils/breadcrumb-log-level.js');
|
||||
const browser = require('./utils/browser.js');
|
||||
const dsn = require('./utils/dsn.js');
|
||||
const error = require('./utils/error.js');
|
||||
const worldwide = require('./utils/worldwide.js');
|
||||
const console$1 = require('./instrument/console.js');
|
||||
const fetch$1 = require('./instrument/fetch.js');
|
||||
const globalError = require('./instrument/globalError.js');
|
||||
const globalUnhandledRejection = require('./instrument/globalUnhandledRejection.js');
|
||||
const handlers = require('./instrument/handlers.js');
|
||||
const is = require('./utils/is.js');
|
||||
const isBrowser = require('./utils/isBrowser.js');
|
||||
const debugLogger = require('./utils/debug-logger.js');
|
||||
const misc = require('./utils/misc.js');
|
||||
const node = require('./utils/node.js');
|
||||
const normalize = require('./utils/normalize.js');
|
||||
const object = require('./utils/object.js');
|
||||
const path = require('./utils/path.js');
|
||||
const promisebuffer = require('./utils/promisebuffer.js');
|
||||
const severity = require('./utils/severity.js');
|
||||
const stacktrace = require('./utils/stacktrace.js');
|
||||
const nodeStackTrace = require('./utils/node-stack-trace.js');
|
||||
const string = require('./utils/string.js');
|
||||
const supports = require('./utils/supports.js');
|
||||
const syncpromise = require('./utils/syncpromise.js');
|
||||
const time = require('./utils/time.js');
|
||||
const tracing = require('./utils/tracing.js');
|
||||
const env = require('./utils/env.js');
|
||||
const envelope$1 = require('./utils/envelope.js');
|
||||
const clientreport = require('./utils/clientreport.js');
|
||||
const ratelimit = require('./utils/ratelimit.js');
|
||||
const baggage = require('./utils/baggage.js');
|
||||
const url = require('./utils/url.js');
|
||||
const eventbuilder = require('./utils/eventbuilder.js');
|
||||
const anr = require('./utils/anr.js');
|
||||
const lru = require('./utils/lru.js');
|
||||
const propagationContext = require('./utils/propagationContext.js');
|
||||
const vercelWaitUntil = require('./utils/vercelWaitUntil.js');
|
||||
const flushIfServerless = require('./utils/flushIfServerless.js');
|
||||
const version = require('./utils/version.js');
|
||||
const debugIds = require('./utils/debug-ids.js');
|
||||
const escapeStringForRegex = require('./vendor/escapeStringForRegex.js');
|
||||
|
||||
|
||||
|
||||
exports.registerSpanErrorInstrumentation = errors.registerSpanErrorInstrumentation;
|
||||
exports.getCapturedScopesOnSpan = utils.getCapturedScopesOnSpan;
|
||||
exports.setCapturedScopesOnSpan = utils.setCapturedScopesOnSpan;
|
||||
exports.TRACING_DEFAULTS = idleSpan.TRACING_DEFAULTS;
|
||||
exports.startIdleSpan = idleSpan.startIdleSpan;
|
||||
exports.SentrySpan = sentrySpan.SentrySpan;
|
||||
exports.SentryNonRecordingSpan = sentryNonRecordingSpan.SentryNonRecordingSpan;
|
||||
exports.SPAN_STATUS_ERROR = spanstatus.SPAN_STATUS_ERROR;
|
||||
exports.SPAN_STATUS_OK = spanstatus.SPAN_STATUS_OK;
|
||||
exports.SPAN_STATUS_UNSET = spanstatus.SPAN_STATUS_UNSET;
|
||||
exports.getSpanStatusFromHttpCode = spanstatus.getSpanStatusFromHttpCode;
|
||||
exports.setHttpStatus = spanstatus.setHttpStatus;
|
||||
exports.continueTrace = trace.continueTrace;
|
||||
exports.startInactiveSpan = trace.startInactiveSpan;
|
||||
exports.startNewTrace = trace.startNewTrace;
|
||||
exports.startSpan = trace.startSpan;
|
||||
exports.startSpanManual = trace.startSpanManual;
|
||||
exports.suppressTracing = trace.suppressTracing;
|
||||
exports.withActiveSpan = trace.withActiveSpan;
|
||||
exports.getDynamicSamplingContextFromClient = dynamicSamplingContext.getDynamicSamplingContextFromClient;
|
||||
exports.getDynamicSamplingContextFromScope = dynamicSamplingContext.getDynamicSamplingContextFromScope;
|
||||
exports.getDynamicSamplingContextFromSpan = dynamicSamplingContext.getDynamicSamplingContextFromSpan;
|
||||
exports.spanToBaggageHeader = dynamicSamplingContext.spanToBaggageHeader;
|
||||
exports.setMeasurement = measurement.setMeasurement;
|
||||
exports.timedEventsToMeasurements = measurement.timedEventsToMeasurements;
|
||||
exports.sampleSpan = sampling.sampleSpan;
|
||||
exports.logSpanEnd = logSpans.logSpanEnd;
|
||||
exports.logSpanStart = logSpans.logSpanStart;
|
||||
exports.SEMANTIC_ATTRIBUTE_CACHE_HIT = semanticAttributes.SEMANTIC_ATTRIBUTE_CACHE_HIT;
|
||||
exports.SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE = semanticAttributes.SEMANTIC_ATTRIBUTE_CACHE_ITEM_SIZE;
|
||||
exports.SEMANTIC_ATTRIBUTE_CACHE_KEY = semanticAttributes.SEMANTIC_ATTRIBUTE_CACHE_KEY;
|
||||
exports.SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = semanticAttributes.SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME;
|
||||
exports.SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD = semanticAttributes.SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD;
|
||||
exports.SEMANTIC_ATTRIBUTE_PROFILE_ID = semanticAttributes.SEMANTIC_ATTRIBUTE_PROFILE_ID;
|
||||
exports.SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME;
|
||||
exports.SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_IDLE_SPAN_FINISH_REASON;
|
||||
exports.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_UNIT;
|
||||
exports.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_MEASUREMENT_VALUE;
|
||||
exports.SEMANTIC_ATTRIBUTE_SENTRY_OP = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_OP;
|
||||
exports.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN;
|
||||
exports.SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_PREVIOUS_TRACE_SAMPLE_RATE;
|
||||
exports.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SAMPLE_RATE;
|
||||
exports.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE;
|
||||
exports.SEMANTIC_ATTRIBUTE_URL_FULL = semanticAttributes.SEMANTIC_ATTRIBUTE_URL_FULL;
|
||||
exports.SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE = semanticAttributes.SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE;
|
||||
exports.createEventEnvelope = envelope.createEventEnvelope;
|
||||
exports.createSessionEnvelope = envelope.createSessionEnvelope;
|
||||
exports.createSpanEnvelope = envelope.createSpanEnvelope;
|
||||
exports.addEventProcessor = exports$1.addEventProcessor;
|
||||
exports.captureCheckIn = exports$1.captureCheckIn;
|
||||
exports.captureEvent = exports$1.captureEvent;
|
||||
exports.captureException = exports$1.captureException;
|
||||
exports.captureMessage = exports$1.captureMessage;
|
||||
exports.captureSession = exports$1.captureSession;
|
||||
exports.close = exports$1.close;
|
||||
exports.endSession = exports$1.endSession;
|
||||
exports.flush = exports$1.flush;
|
||||
exports.isEnabled = exports$1.isEnabled;
|
||||
exports.isInitialized = exports$1.isInitialized;
|
||||
exports.lastEventId = exports$1.lastEventId;
|
||||
exports.setContext = exports$1.setContext;
|
||||
exports.setExtra = exports$1.setExtra;
|
||||
exports.setExtras = exports$1.setExtras;
|
||||
exports.setTag = exports$1.setTag;
|
||||
exports.setTags = exports$1.setTags;
|
||||
exports.setUser = exports$1.setUser;
|
||||
exports.startSession = exports$1.startSession;
|
||||
exports.withMonitor = exports$1.withMonitor;
|
||||
exports.getClient = currentScopes.getClient;
|
||||
exports.getCurrentScope = currentScopes.getCurrentScope;
|
||||
exports.getGlobalScope = currentScopes.getGlobalScope;
|
||||
exports.getIsolationScope = currentScopes.getIsolationScope;
|
||||
exports.getTraceContextFromScope = currentScopes.getTraceContextFromScope;
|
||||
exports.withIsolationScope = currentScopes.withIsolationScope;
|
||||
exports.withScope = currentScopes.withScope;
|
||||
exports.getDefaultCurrentScope = defaultScopes.getDefaultCurrentScope;
|
||||
exports.getDefaultIsolationScope = defaultScopes.getDefaultIsolationScope;
|
||||
exports.setAsyncContextStrategy = index.setAsyncContextStrategy;
|
||||
exports.getGlobalSingleton = carrier.getGlobalSingleton;
|
||||
exports.getMainCarrier = carrier.getMainCarrier;
|
||||
exports.closeSession = session.closeSession;
|
||||
exports.makeSession = session.makeSession;
|
||||
exports.updateSession = session.updateSession;
|
||||
exports.Scope = scope.Scope;
|
||||
exports.notifyEventProcessors = eventProcessors.notifyEventProcessors;
|
||||
exports.getEnvelopeEndpointWithUrlEncodedAuth = api.getEnvelopeEndpointWithUrlEncodedAuth;
|
||||
exports.getReportDialogEndpoint = api.getReportDialogEndpoint;
|
||||
exports.BaseClient = client.BaseClient;
|
||||
exports.Client = client.Client;
|
||||
exports.ServerRuntimeClient = serverRuntimeClient.ServerRuntimeClient;
|
||||
exports.initAndBind = sdk.initAndBind;
|
||||
exports.setCurrentClient = sdk.setCurrentClient;
|
||||
exports.createTransport = base.createTransport;
|
||||
exports.makeOfflineTransport = offline.makeOfflineTransport;
|
||||
exports.makeMultiplexedTransport = multiplexed.makeMultiplexedTransport;
|
||||
exports.addIntegration = integration.addIntegration;
|
||||
exports.defineIntegration = integration.defineIntegration;
|
||||
exports.getIntegrationsToSetup = integration.getIntegrationsToSetup;
|
||||
exports.applyScopeDataToEvent = applyScopeDataToEvent.applyScopeDataToEvent;
|
||||
exports.mergeScopeData = applyScopeDataToEvent.mergeScopeData;
|
||||
exports.prepareEvent = prepareEvent.prepareEvent;
|
||||
exports.createCheckInEnvelope = checkin.createCheckInEnvelope;
|
||||
exports.hasSpansEnabled = hasSpansEnabled.hasSpansEnabled;
|
||||
exports.hasTracingEnabled = hasSpansEnabled.hasTracingEnabled;
|
||||
exports.isSentryRequestUrl = isSentryRequestUrl.isSentryRequestUrl;
|
||||
exports.handleCallbackErrors = handleCallbackErrors.handleCallbackErrors;
|
||||
exports.fmt = parameterize.fmt;
|
||||
exports.parameterize = parameterize.parameterize;
|
||||
exports.addAutoIpAddressToSession = ipAddress.addAutoIpAddressToSession;
|
||||
exports.addAutoIpAddressToUser = ipAddress.addAutoIpAddressToUser;
|
||||
exports.addChildSpanToSpan = spanUtils.addChildSpanToSpan;
|
||||
exports.convertSpanLinksForEnvelope = spanUtils.convertSpanLinksForEnvelope;
|
||||
exports.getActiveSpan = spanUtils.getActiveSpan;
|
||||
exports.getRootSpan = spanUtils.getRootSpan;
|
||||
exports.getSpanDescendants = spanUtils.getSpanDescendants;
|
||||
exports.getStatusMessage = spanUtils.getStatusMessage;
|
||||
exports.spanIsSampled = spanUtils.spanIsSampled;
|
||||
exports.spanTimeInputToSeconds = spanUtils.spanTimeInputToSeconds;
|
||||
exports.spanToJSON = spanUtils.spanToJSON;
|
||||
exports.spanToTraceContext = spanUtils.spanToTraceContext;
|
||||
exports.spanToTraceHeader = spanUtils.spanToTraceHeader;
|
||||
exports.updateSpanName = spanUtils.updateSpanName;
|
||||
exports.parseSampleRate = parseSampleRate.parseSampleRate;
|
||||
exports.applySdkMetadata = sdkMetadata.applySdkMetadata;
|
||||
exports.getTraceData = traceData.getTraceData;
|
||||
exports.getTraceMetaTags = meta.getTraceMetaTags;
|
||||
exports.debounce = debounce.debounce;
|
||||
exports.extractQueryParamsFromUrl = request.extractQueryParamsFromUrl;
|
||||
exports.headersToDict = request.headersToDict;
|
||||
exports.httpRequestToRequestData = request.httpRequestToRequestData;
|
||||
exports.winterCGHeadersToDict = request.winterCGHeadersToDict;
|
||||
exports.winterCGRequestToRequestData = request.winterCGRequestToRequestData;
|
||||
exports.DEFAULT_ENVIRONMENT = constants.DEFAULT_ENVIRONMENT;
|
||||
exports.addBreadcrumb = breadcrumbs.addBreadcrumb;
|
||||
exports.functionToStringIntegration = functiontostring.functionToStringIntegration;
|
||||
exports.eventFiltersIntegration = eventFilters.eventFiltersIntegration;
|
||||
exports.inboundFiltersIntegration = eventFilters.inboundFiltersIntegration;
|
||||
exports.linkedErrorsIntegration = linkederrors.linkedErrorsIntegration;
|
||||
exports.moduleMetadataIntegration = metadata.moduleMetadataIntegration;
|
||||
exports.requestDataIntegration = requestdata.requestDataIntegration;
|
||||
exports.captureConsoleIntegration = captureconsole.captureConsoleIntegration;
|
||||
exports.dedupeIntegration = dedupe.dedupeIntegration;
|
||||
exports.extraErrorDataIntegration = extraerrordata.extraErrorDataIntegration;
|
||||
exports.rewriteFramesIntegration = rewriteframes.rewriteFramesIntegration;
|
||||
exports.instrumentSupabaseClient = supabase.instrumentSupabaseClient;
|
||||
exports.supabaseIntegration = supabase.supabaseIntegration;
|
||||
exports.zodErrorsIntegration = zoderrors.zodErrorsIntegration;
|
||||
exports.thirdPartyErrorFilterIntegration = thirdPartyErrorsFilter.thirdPartyErrorFilterIntegration;
|
||||
exports.consoleIntegration = console.consoleIntegration;
|
||||
exports.featureFlagsIntegration = featureFlagsIntegration.featureFlagsIntegration;
|
||||
exports.profiler = profiling.profiler;
|
||||
exports.instrumentFetchRequest = fetch.instrumentFetchRequest;
|
||||
exports.trpcMiddleware = trpc.trpcMiddleware;
|
||||
exports.wrapMcpServerWithSentry = index$1.wrapMcpServerWithSentry;
|
||||
exports.captureFeedback = feedback.captureFeedback;
|
||||
exports._INTERNAL_captureLog = exports$2._INTERNAL_captureLog;
|
||||
exports._INTERNAL_captureSerializedLog = exports$2._INTERNAL_captureSerializedLog;
|
||||
exports._INTERNAL_flushLogsBuffer = exports$2._INTERNAL_flushLogsBuffer;
|
||||
exports.consoleLoggingIntegration = consoleIntegration.consoleLoggingIntegration;
|
||||
exports.addVercelAiProcessors = vercelAi.addVercelAiProcessors;
|
||||
exports.instrumentOpenAiClient = index$2.instrumentOpenAiClient;
|
||||
exports.OPENAI_INTEGRATION_NAME = constants$1.OPENAI_INTEGRATION_NAME;
|
||||
exports._INTERNAL_FLAG_BUFFER_SIZE = featureFlags._INTERNAL_FLAG_BUFFER_SIZE;
|
||||
exports._INTERNAL_MAX_FLAGS_PER_SPAN = featureFlags._INTERNAL_MAX_FLAGS_PER_SPAN;
|
||||
exports._INTERNAL_addFeatureFlagToActiveSpan = featureFlags._INTERNAL_addFeatureFlagToActiveSpan;
|
||||
exports._INTERNAL_copyFlagsFromScopeToEvent = featureFlags._INTERNAL_copyFlagsFromScopeToEvent;
|
||||
exports._INTERNAL_insertFlagToScope = featureFlags._INTERNAL_insertFlagToScope;
|
||||
exports.applyAggregateErrorsToEvent = aggregateErrors.applyAggregateErrorsToEvent;
|
||||
exports.getBreadcrumbLogLevelFromHttpStatusCode = breadcrumbLogLevel.getBreadcrumbLogLevelFromHttpStatusCode;
|
||||
exports.getComponentName = browser.getComponentName;
|
||||
exports.getLocationHref = browser.getLocationHref;
|
||||
exports.htmlTreeAsString = browser.htmlTreeAsString;
|
||||
exports.dsnFromString = dsn.dsnFromString;
|
||||
exports.dsnToString = dsn.dsnToString;
|
||||
exports.makeDsn = dsn.makeDsn;
|
||||
exports.SentryError = error.SentryError;
|
||||
exports.GLOBAL_OBJ = worldwide.GLOBAL_OBJ;
|
||||
exports.addConsoleInstrumentationHandler = console$1.addConsoleInstrumentationHandler;
|
||||
exports.addFetchEndInstrumentationHandler = fetch$1.addFetchEndInstrumentationHandler;
|
||||
exports.addFetchInstrumentationHandler = fetch$1.addFetchInstrumentationHandler;
|
||||
exports.addGlobalErrorInstrumentationHandler = globalError.addGlobalErrorInstrumentationHandler;
|
||||
exports.addGlobalUnhandledRejectionInstrumentationHandler = globalUnhandledRejection.addGlobalUnhandledRejectionInstrumentationHandler;
|
||||
exports.addHandler = handlers.addHandler;
|
||||
exports.maybeInstrument = handlers.maybeInstrument;
|
||||
exports.resetInstrumentationHandlers = handlers.resetInstrumentationHandlers;
|
||||
exports.triggerHandlers = handlers.triggerHandlers;
|
||||
exports.isDOMError = is.isDOMError;
|
||||
exports.isDOMException = is.isDOMException;
|
||||
exports.isElement = is.isElement;
|
||||
exports.isError = is.isError;
|
||||
exports.isErrorEvent = is.isErrorEvent;
|
||||
exports.isEvent = is.isEvent;
|
||||
exports.isInstanceOf = is.isInstanceOf;
|
||||
exports.isParameterizedString = is.isParameterizedString;
|
||||
exports.isPlainObject = is.isPlainObject;
|
||||
exports.isPrimitive = is.isPrimitive;
|
||||
exports.isRegExp = is.isRegExp;
|
||||
exports.isString = is.isString;
|
||||
exports.isSyntheticEvent = is.isSyntheticEvent;
|
||||
exports.isThenable = is.isThenable;
|
||||
exports.isVueViewModel = is.isVueViewModel;
|
||||
exports.isBrowser = isBrowser.isBrowser;
|
||||
exports.CONSOLE_LEVELS = debugLogger.CONSOLE_LEVELS;
|
||||
exports.consoleSandbox = debugLogger.consoleSandbox;
|
||||
exports.debug = debugLogger.debug;
|
||||
exports.logger = debugLogger.logger;
|
||||
exports.originalConsoleMethods = debugLogger.originalConsoleMethods;
|
||||
exports.addContextToFrame = misc.addContextToFrame;
|
||||
exports.addExceptionMechanism = misc.addExceptionMechanism;
|
||||
exports.addExceptionTypeValue = misc.addExceptionTypeValue;
|
||||
exports.checkOrSetAlreadyCaught = misc.checkOrSetAlreadyCaught;
|
||||
exports.getEventDescription = misc.getEventDescription;
|
||||
exports.parseSemver = misc.parseSemver;
|
||||
exports.uuid4 = misc.uuid4;
|
||||
exports.isNodeEnv = node.isNodeEnv;
|
||||
exports.loadModule = node.loadModule;
|
||||
exports.normalize = normalize.normalize;
|
||||
exports.normalizeToSize = normalize.normalizeToSize;
|
||||
exports.normalizeUrlToBase = normalize.normalizeUrlToBase;
|
||||
exports.addNonEnumerableProperty = object.addNonEnumerableProperty;
|
||||
exports.convertToPlainObject = object.convertToPlainObject;
|
||||
exports.dropUndefinedKeys = object.dropUndefinedKeys;
|
||||
exports.extractExceptionKeysForMessage = object.extractExceptionKeysForMessage;
|
||||
exports.fill = object.fill;
|
||||
exports.getOriginalFunction = object.getOriginalFunction;
|
||||
exports.markFunctionWrapped = object.markFunctionWrapped;
|
||||
exports.objectify = object.objectify;
|
||||
exports.basename = path.basename;
|
||||
exports.dirname = path.dirname;
|
||||
exports.isAbsolute = path.isAbsolute;
|
||||
exports.join = path.join;
|
||||
exports.normalizePath = path.normalizePath;
|
||||
exports.relative = path.relative;
|
||||
exports.resolve = path.resolve;
|
||||
exports.SENTRY_BUFFER_FULL_ERROR = promisebuffer.SENTRY_BUFFER_FULL_ERROR;
|
||||
exports.makePromiseBuffer = promisebuffer.makePromiseBuffer;
|
||||
exports.severityLevelFromString = severity.severityLevelFromString;
|
||||
exports.UNKNOWN_FUNCTION = stacktrace.UNKNOWN_FUNCTION;
|
||||
exports.createStackParser = stacktrace.createStackParser;
|
||||
exports.getFramesFromEvent = stacktrace.getFramesFromEvent;
|
||||
exports.getFunctionName = stacktrace.getFunctionName;
|
||||
exports.stackParserFromStackParserOptions = stacktrace.stackParserFromStackParserOptions;
|
||||
exports.stripSentryFramesAndReverse = stacktrace.stripSentryFramesAndReverse;
|
||||
exports.filenameIsInApp = nodeStackTrace.filenameIsInApp;
|
||||
exports.node = nodeStackTrace.node;
|
||||
exports.nodeStackLineParser = nodeStackTrace.nodeStackLineParser;
|
||||
exports.isMatchingPattern = string.isMatchingPattern;
|
||||
exports.safeJoin = string.safeJoin;
|
||||
exports.snipLine = string.snipLine;
|
||||
exports.stringMatchesSomePattern = string.stringMatchesSomePattern;
|
||||
exports.truncate = string.truncate;
|
||||
exports.isNativeFunction = supports.isNativeFunction;
|
||||
exports.supportsDOMError = supports.supportsDOMError;
|
||||
exports.supportsDOMException = supports.supportsDOMException;
|
||||
exports.supportsErrorEvent = supports.supportsErrorEvent;
|
||||
exports.supportsFetch = supports.supportsFetch;
|
||||
exports.supportsHistory = supports.supportsHistory;
|
||||
exports.supportsNativeFetch = supports.supportsNativeFetch;
|
||||
exports.supportsReferrerPolicy = supports.supportsReferrerPolicy;
|
||||
exports.supportsReportingObserver = supports.supportsReportingObserver;
|
||||
exports.SyncPromise = syncpromise.SyncPromise;
|
||||
exports.rejectedSyncPromise = syncpromise.rejectedSyncPromise;
|
||||
exports.resolvedSyncPromise = syncpromise.resolvedSyncPromise;
|
||||
exports.browserPerformanceTimeOrigin = time.browserPerformanceTimeOrigin;
|
||||
exports.dateTimestampInSeconds = time.dateTimestampInSeconds;
|
||||
exports.timestampInSeconds = time.timestampInSeconds;
|
||||
exports.TRACEPARENT_REGEXP = tracing.TRACEPARENT_REGEXP;
|
||||
exports.extractTraceparentData = tracing.extractTraceparentData;
|
||||
exports.generateSentryTraceHeader = tracing.generateSentryTraceHeader;
|
||||
exports.propagationContextFromHeaders = tracing.propagationContextFromHeaders;
|
||||
exports.getSDKSource = env.getSDKSource;
|
||||
exports.isBrowserBundle = env.isBrowserBundle;
|
||||
exports.addItemToEnvelope = envelope$1.addItemToEnvelope;
|
||||
exports.createAttachmentEnvelopeItem = envelope$1.createAttachmentEnvelopeItem;
|
||||
exports.createEnvelope = envelope$1.createEnvelope;
|
||||
exports.createEventEnvelopeHeaders = envelope$1.createEventEnvelopeHeaders;
|
||||
exports.createSpanEnvelopeItem = envelope$1.createSpanEnvelopeItem;
|
||||
exports.envelopeContainsItemType = envelope$1.envelopeContainsItemType;
|
||||
exports.envelopeItemTypeToDataCategory = envelope$1.envelopeItemTypeToDataCategory;
|
||||
exports.forEachEnvelopeItem = envelope$1.forEachEnvelopeItem;
|
||||
exports.getSdkMetadataForEnvelopeHeader = envelope$1.getSdkMetadataForEnvelopeHeader;
|
||||
exports.parseEnvelope = envelope$1.parseEnvelope;
|
||||
exports.serializeEnvelope = envelope$1.serializeEnvelope;
|
||||
exports.createClientReportEnvelope = clientreport.createClientReportEnvelope;
|
||||
exports.DEFAULT_RETRY_AFTER = ratelimit.DEFAULT_RETRY_AFTER;
|
||||
exports.disabledUntil = ratelimit.disabledUntil;
|
||||
exports.isRateLimited = ratelimit.isRateLimited;
|
||||
exports.parseRetryAfterHeader = ratelimit.parseRetryAfterHeader;
|
||||
exports.updateRateLimits = ratelimit.updateRateLimits;
|
||||
exports.MAX_BAGGAGE_STRING_LENGTH = baggage.MAX_BAGGAGE_STRING_LENGTH;
|
||||
exports.SENTRY_BAGGAGE_KEY_PREFIX = baggage.SENTRY_BAGGAGE_KEY_PREFIX;
|
||||
exports.SENTRY_BAGGAGE_KEY_PREFIX_REGEX = baggage.SENTRY_BAGGAGE_KEY_PREFIX_REGEX;
|
||||
exports.baggageHeaderToDynamicSamplingContext = baggage.baggageHeaderToDynamicSamplingContext;
|
||||
exports.dynamicSamplingContextToSentryBaggageHeader = baggage.dynamicSamplingContextToSentryBaggageHeader;
|
||||
exports.objectToBaggageHeader = baggage.objectToBaggageHeader;
|
||||
exports.parseBaggageHeader = baggage.parseBaggageHeader;
|
||||
exports.getHttpSpanDetailsFromUrlObject = url.getHttpSpanDetailsFromUrlObject;
|
||||
exports.getSanitizedUrlString = url.getSanitizedUrlString;
|
||||
exports.getSanitizedUrlStringFromUrlObject = url.getSanitizedUrlStringFromUrlObject;
|
||||
exports.isURLObjectRelative = url.isURLObjectRelative;
|
||||
exports.parseStringToURLObject = url.parseStringToURLObject;
|
||||
exports.parseUrl = url.parseUrl;
|
||||
exports.stripUrlQueryAndFragment = url.stripUrlQueryAndFragment;
|
||||
exports.eventFromMessage = eventbuilder.eventFromMessage;
|
||||
exports.eventFromUnknownInput = eventbuilder.eventFromUnknownInput;
|
||||
exports.exceptionFromError = eventbuilder.exceptionFromError;
|
||||
exports.parseStackFrames = eventbuilder.parseStackFrames;
|
||||
exports.callFrameToStackFrame = anr.callFrameToStackFrame;
|
||||
exports.watchdogTimer = anr.watchdogTimer;
|
||||
exports.LRUMap = lru.LRUMap;
|
||||
exports.generateSpanId = propagationContext.generateSpanId;
|
||||
exports.generateTraceId = propagationContext.generateTraceId;
|
||||
exports.vercelWaitUntil = vercelWaitUntil.vercelWaitUntil;
|
||||
exports.flushIfServerless = flushIfServerless.flushIfServerless;
|
||||
exports.SDK_VERSION = version.SDK_VERSION;
|
||||
exports.getDebugImagesForResources = debugIds.getDebugImagesForResources;
|
||||
exports.getFilenameToDebugIdMap = debugIds.getFilenameToDebugIdMap;
|
||||
exports.escapeStringForRegex = escapeStringForRegex.escapeStringForRegex;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/index.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/index.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
||||
45
dev/env/node_modules/@sentry/core/build/cjs/instrument/console.js
generated
vendored
Executable file
45
dev/env/node_modules/@sentry/core/build/cjs/instrument/console.js
generated
vendored
Executable file
@@ -0,0 +1,45 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const debugLogger = require('../utils/debug-logger.js');
|
||||
const object = require('../utils/object.js');
|
||||
const worldwide = require('../utils/worldwide.js');
|
||||
const handlers = require('./handlers.js');
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when a console.xxx method is called.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addConsoleInstrumentationHandler(handler) {
|
||||
const type = 'console';
|
||||
handlers.addHandler(type, handler);
|
||||
handlers.maybeInstrument(type, instrumentConsole);
|
||||
}
|
||||
|
||||
function instrumentConsole() {
|
||||
if (!('console' in worldwide.GLOBAL_OBJ)) {
|
||||
return;
|
||||
}
|
||||
|
||||
debugLogger.CONSOLE_LEVELS.forEach(function (level) {
|
||||
if (!(level in worldwide.GLOBAL_OBJ.console)) {
|
||||
return;
|
||||
}
|
||||
|
||||
object.fill(worldwide.GLOBAL_OBJ.console, level, function (originalConsoleMethod) {
|
||||
debugLogger.originalConsoleMethods[level] = originalConsoleMethod;
|
||||
|
||||
return function (...args) {
|
||||
const handlerData = { args, level };
|
||||
handlers.triggerHandlers('console', handlerData);
|
||||
|
||||
const log = debugLogger.originalConsoleMethods[level];
|
||||
log?.apply(worldwide.GLOBAL_OBJ.console, args);
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
exports.addConsoleInstrumentationHandler = addConsoleInstrumentationHandler;
|
||||
//# sourceMappingURL=console.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/console.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/console.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"console.js","sources":["../../../src/instrument/console.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { ConsoleLevel, HandlerDataConsole } from '../types-hoist/instrument';\nimport { CONSOLE_LEVELS, originalConsoleMethods } from '../utils/debug-logger';\nimport { fill } from '../utils/object';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers';\n\n/**\n * Add an instrumentation handler for when a console.xxx method is called.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addConsoleInstrumentationHandler(handler: (data: HandlerDataConsole) => void): void {\n const type = 'console';\n addHandler(type, handler);\n maybeInstrument(type, instrumentConsole);\n}\n\nfunction instrumentConsole(): void {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n CONSOLE_LEVELS.forEach(function (level: ConsoleLevel): void {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod: () => any): Function {\n originalConsoleMethods[level] = originalConsoleMethod;\n\n return function (...args: any[]): void {\n const handlerData: HandlerDataConsole = { args, level };\n triggerHandlers('console', handlerData);\n\n const log = originalConsoleMethods[level];\n log?.apply(GLOBAL_OBJ.console, args);\n };\n });\n });\n}\n"],"names":["addHandler","maybeInstrument","GLOBAL_OBJ","CONSOLE_LEVELS","fill","originalConsoleMethods","triggerHandlers"],"mappings":";;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAA4C;AACpG,EAAE,MAAM,IAAA,GAAO,SAAS;AACxB,EAAEA,mBAAU,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,EAAEC,wBAAe,CAAC,IAAI,EAAE,iBAAiB,CAAC;AAC1C;;AAEA,SAAS,iBAAiB,GAAS;AACnC,EAAE,IAAI,EAAE,aAAaC,oBAAU,CAAC,EAAE;AAClC,IAAI;AACJ;;AAEA,EAAEC,0BAAc,CAAC,OAAO,CAAC,UAAU,KAAK,EAAsB;AAC9D,IAAI,IAAI,EAAE,KAAA,IAASD,oBAAU,CAAC,OAAO,CAAC,EAAE;AACxC,MAAM;AACN;;AAEA,IAAIE,WAAI,CAACF,oBAAU,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,qBAAqB,EAAuB;AAC1F,MAAMG,kCAAsB,CAAC,KAAK,CAAA,GAAI,qBAAqB;;AAE3D,MAAM,OAAO,UAAU,GAAG,IAAI,EAAe;AAC7C,QAAQ,MAAM,WAAW,GAAuB,EAAE,IAAI,EAAE,OAAO;AAC/D,QAAQC,wBAAe,CAAC,SAAS,EAAE,WAAW,CAAC;;AAE/C,QAAQ,MAAM,GAAA,GAAMD,kCAAsB,CAAC,KAAK,CAAC;AACjD,QAAQ,GAAG,EAAE,KAAK,CAACH,oBAAU,CAAC,OAAO,EAAE,IAAI,CAAC;AAC5C,OAAO;AACP,KAAK,CAAC;AACN,GAAG,CAAC;AACJ;;;;"}
|
||||
281
dev/env/node_modules/@sentry/core/build/cjs/instrument/fetch.js
generated
vendored
Executable file
281
dev/env/node_modules/@sentry/core/build/cjs/instrument/fetch.js
generated
vendored
Executable file
@@ -0,0 +1,281 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const is = require('../utils/is.js');
|
||||
const object = require('../utils/object.js');
|
||||
const supports = require('../utils/supports.js');
|
||||
const time = require('../utils/time.js');
|
||||
const worldwide = require('../utils/worldwide.js');
|
||||
const handlers = require('./handlers.js');
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when a fetch request happens.
|
||||
* The handler function is called once when the request starts and once when it ends,
|
||||
* which can be identified by checking if it has an `endTimestamp`.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addFetchInstrumentationHandler(
|
||||
handler,
|
||||
skipNativeFetchCheck,
|
||||
) {
|
||||
const type = 'fetch';
|
||||
handlers.addHandler(type, handler);
|
||||
handlers.maybeInstrument(type, () => instrumentFetch(undefined, skipNativeFetchCheck));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for long-lived fetch requests, like consuming server-sent events (SSE) via fetch.
|
||||
* The handler will resolve the request body and emit the actual `endTimestamp`, so that the
|
||||
* span can be updated accordingly.
|
||||
*
|
||||
* Only used internally
|
||||
* @hidden
|
||||
*/
|
||||
function addFetchEndInstrumentationHandler(handler) {
|
||||
const type = 'fetch-body-resolved';
|
||||
handlers.addHandler(type, handler);
|
||||
handlers.maybeInstrument(type, () => instrumentFetch(streamHandler));
|
||||
}
|
||||
|
||||
function instrumentFetch(onFetchResolved, skipNativeFetchCheck = false) {
|
||||
if (skipNativeFetchCheck && !supports.supportsNativeFetch()) {
|
||||
return;
|
||||
}
|
||||
|
||||
object.fill(worldwide.GLOBAL_OBJ, 'fetch', function (originalFetch) {
|
||||
return function (...args) {
|
||||
// We capture the error right here and not in the Promise error callback because Safari (and probably other
|
||||
// browsers too) will wipe the stack trace up to this point, only leaving us with this file which is useless.
|
||||
|
||||
// NOTE: If you are a Sentry user, and you are seeing this stack frame,
|
||||
// it means the error, that was caused by your fetch call did not
|
||||
// have a stack trace, so the SDK backfilled the stack trace so
|
||||
// you can see which fetch call failed.
|
||||
const virtualError = new Error();
|
||||
|
||||
const { method, url } = parseFetchArgs(args);
|
||||
const handlerData = {
|
||||
args,
|
||||
fetchData: {
|
||||
method,
|
||||
url,
|
||||
},
|
||||
startTimestamp: time.timestampInSeconds() * 1000,
|
||||
// // Adding the error to be able to fingerprint the failed fetch event in HttpClient instrumentation
|
||||
virtualError,
|
||||
headers: getHeadersFromFetchArgs(args),
|
||||
};
|
||||
|
||||
// if there is no callback, fetch is instrumented directly
|
||||
if (!onFetchResolved) {
|
||||
handlers.triggerHandlers('fetch', {
|
||||
...handlerData,
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
return originalFetch.apply(worldwide.GLOBAL_OBJ, args).then(
|
||||
async (response) => {
|
||||
if (onFetchResolved) {
|
||||
onFetchResolved(response);
|
||||
} else {
|
||||
handlers.triggerHandlers('fetch', {
|
||||
...handlerData,
|
||||
endTimestamp: time.timestampInSeconds() * 1000,
|
||||
response,
|
||||
});
|
||||
}
|
||||
|
||||
return response;
|
||||
},
|
||||
(error) => {
|
||||
handlers.triggerHandlers('fetch', {
|
||||
...handlerData,
|
||||
endTimestamp: time.timestampInSeconds() * 1000,
|
||||
error,
|
||||
});
|
||||
|
||||
if (is.isError(error) && error.stack === undefined) {
|
||||
// NOTE: If you are a Sentry user, and you are seeing this stack frame,
|
||||
// it means the error, that was caused by your fetch call did not
|
||||
// have a stack trace, so the SDK backfilled the stack trace so
|
||||
// you can see which fetch call failed.
|
||||
error.stack = virtualError.stack;
|
||||
object.addNonEnumerableProperty(error, 'framesToPop', 1);
|
||||
}
|
||||
|
||||
// We enhance the not-so-helpful "Failed to fetch" error messages with the host
|
||||
// Possible messages we handle here:
|
||||
// * "Failed to fetch" (chromium)
|
||||
// * "Load failed" (webkit)
|
||||
// * "NetworkError when attempting to fetch resource." (firefox)
|
||||
if (
|
||||
error instanceof TypeError &&
|
||||
(error.message === 'Failed to fetch' ||
|
||||
error.message === 'Load failed' ||
|
||||
error.message === 'NetworkError when attempting to fetch resource.')
|
||||
) {
|
||||
try {
|
||||
const url = new URL(handlerData.fetchData.url);
|
||||
error.message = `${error.message} (${url.host})`;
|
||||
} catch {
|
||||
// ignore it if errors happen here
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: If you are a Sentry user, and you are seeing this stack frame,
|
||||
// it means the sentry.javascript SDK caught an error invoking your application code.
|
||||
// This is expected behavior and NOT indicative of a bug with sentry.javascript.
|
||||
throw error;
|
||||
},
|
||||
);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function resolveResponse(res, onFinishedResolving) {
|
||||
if (res?.body) {
|
||||
const body = res.body;
|
||||
const responseReader = body.getReader();
|
||||
|
||||
// Define a maximum duration after which we just cancel
|
||||
const maxFetchDurationTimeout = setTimeout(
|
||||
() => {
|
||||
body.cancel().then(null, () => {
|
||||
// noop
|
||||
});
|
||||
},
|
||||
90 * 1000, // 90s
|
||||
);
|
||||
|
||||
let readingActive = true;
|
||||
while (readingActive) {
|
||||
let chunkTimeout;
|
||||
try {
|
||||
// abort reading if read op takes more than 5s
|
||||
chunkTimeout = setTimeout(() => {
|
||||
body.cancel().then(null, () => {
|
||||
// noop on error
|
||||
});
|
||||
}, 5000);
|
||||
|
||||
// This .read() call will reject/throw when we abort due to timeouts through `body.cancel()`
|
||||
const { done } = await responseReader.read();
|
||||
|
||||
clearTimeout(chunkTimeout);
|
||||
|
||||
if (done) {
|
||||
onFinishedResolving();
|
||||
readingActive = false;
|
||||
}
|
||||
} catch {
|
||||
readingActive = false;
|
||||
} finally {
|
||||
clearTimeout(chunkTimeout);
|
||||
}
|
||||
}
|
||||
|
||||
clearTimeout(maxFetchDurationTimeout);
|
||||
|
||||
responseReader.releaseLock();
|
||||
body.cancel().then(null, () => {
|
||||
// noop on error
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function streamHandler(response) {
|
||||
// clone response for awaiting stream
|
||||
let clonedResponseForResolving;
|
||||
try {
|
||||
clonedResponseForResolving = response.clone();
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
resolveResponse(clonedResponseForResolving, () => {
|
||||
handlers.triggerHandlers('fetch-body-resolved', {
|
||||
endTimestamp: time.timestampInSeconds() * 1000,
|
||||
response,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function hasProp(obj, prop) {
|
||||
return !!obj && typeof obj === 'object' && !!(obj )[prop];
|
||||
}
|
||||
|
||||
function getUrlFromResource(resource) {
|
||||
if (typeof resource === 'string') {
|
||||
return resource;
|
||||
}
|
||||
|
||||
if (!resource) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (hasProp(resource, 'url')) {
|
||||
return resource.url;
|
||||
}
|
||||
|
||||
if (resource.toString) {
|
||||
return resource.toString();
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the fetch arguments to find the used Http method and the url of the request.
|
||||
* Exported for tests only.
|
||||
*/
|
||||
function parseFetchArgs(fetchArgs) {
|
||||
if (fetchArgs.length === 0) {
|
||||
return { method: 'GET', url: '' };
|
||||
}
|
||||
|
||||
if (fetchArgs.length === 2) {
|
||||
const [url, options] = fetchArgs ;
|
||||
|
||||
return {
|
||||
url: getUrlFromResource(url),
|
||||
method: hasProp(options, 'method') ? String(options.method).toUpperCase() : 'GET',
|
||||
};
|
||||
}
|
||||
|
||||
const arg = fetchArgs[0];
|
||||
return {
|
||||
url: getUrlFromResource(arg ),
|
||||
method: hasProp(arg, 'method') ? String(arg.method).toUpperCase() : 'GET',
|
||||
};
|
||||
}
|
||||
|
||||
function getHeadersFromFetchArgs(fetchArgs) {
|
||||
const [requestArgument, optionsArgument] = fetchArgs;
|
||||
|
||||
try {
|
||||
if (
|
||||
typeof optionsArgument === 'object' &&
|
||||
optionsArgument !== null &&
|
||||
'headers' in optionsArgument &&
|
||||
optionsArgument.headers
|
||||
) {
|
||||
return new Headers(optionsArgument.headers );
|
||||
}
|
||||
|
||||
if (is.isRequest(requestArgument)) {
|
||||
return new Headers(requestArgument.headers);
|
||||
}
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
exports.addFetchEndInstrumentationHandler = addFetchEndInstrumentationHandler;
|
||||
exports.addFetchInstrumentationHandler = addFetchInstrumentationHandler;
|
||||
exports.parseFetchArgs = parseFetchArgs;
|
||||
//# sourceMappingURL=fetch.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/fetch.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/fetch.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
53
dev/env/node_modules/@sentry/core/build/cjs/instrument/globalError.js
generated
vendored
Executable file
53
dev/env/node_modules/@sentry/core/build/cjs/instrument/globalError.js
generated
vendored
Executable file
@@ -0,0 +1,53 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const worldwide = require('../utils/worldwide.js');
|
||||
const handlers = require('./handlers.js');
|
||||
|
||||
let _oldOnErrorHandler = null;
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when an error is captured by the global error handler.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addGlobalErrorInstrumentationHandler(handler) {
|
||||
const type = 'error';
|
||||
handlers.addHandler(type, handler);
|
||||
handlers.maybeInstrument(type, instrumentError);
|
||||
}
|
||||
|
||||
function instrumentError() {
|
||||
_oldOnErrorHandler = worldwide.GLOBAL_OBJ.onerror;
|
||||
|
||||
// Note: The reason we are doing window.onerror instead of window.addEventListener('error')
|
||||
// is that we are using this handler in the Loader Script, to handle buffered errors consistently
|
||||
worldwide.GLOBAL_OBJ.onerror = function (
|
||||
msg,
|
||||
url,
|
||||
line,
|
||||
column,
|
||||
error,
|
||||
) {
|
||||
const handlerData = {
|
||||
column,
|
||||
error,
|
||||
line,
|
||||
msg,
|
||||
url,
|
||||
};
|
||||
handlers.triggerHandlers('error', handlerData);
|
||||
|
||||
if (_oldOnErrorHandler) {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
return _oldOnErrorHandler.apply(this, arguments);
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
worldwide.GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;
|
||||
}
|
||||
|
||||
exports.addGlobalErrorInstrumentationHandler = addGlobalErrorInstrumentationHandler;
|
||||
//# sourceMappingURL=globalError.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/globalError.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/globalError.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"globalError.js","sources":["../../../src/instrument/globalError.ts"],"sourcesContent":["import type { HandlerDataError } from '../types-hoist/instrument';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers';\n\nlet _oldOnErrorHandler: (typeof GLOBAL_OBJ)['onerror'] | null = null;\n\n/**\n * Add an instrumentation handler for when an error is captured by the global error handler.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addGlobalErrorInstrumentationHandler(handler: (data: HandlerDataError) => void): void {\n const type = 'error';\n addHandler(type, handler);\n maybeInstrument(type, instrumentError);\n}\n\nfunction instrumentError(): void {\n _oldOnErrorHandler = GLOBAL_OBJ.onerror;\n\n // Note: The reason we are doing window.onerror instead of window.addEventListener('error')\n // is that we are using this handler in the Loader Script, to handle buffered errors consistently\n GLOBAL_OBJ.onerror = function (\n msg: string | object,\n url?: string,\n line?: number,\n column?: number,\n error?: Error,\n ): boolean {\n const handlerData: HandlerDataError = {\n column,\n error,\n line,\n msg,\n url,\n };\n triggerHandlers('error', handlerData);\n\n if (_oldOnErrorHandler) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnErrorHandler.apply(this, arguments);\n }\n\n return false;\n };\n\n GLOBAL_OBJ.onerror.__SENTRY_INSTRUMENTED__ = true;\n}\n"],"names":["addHandler","maybeInstrument","GLOBAL_OBJ","triggerHandlers"],"mappings":";;;;;AAIA,IAAI,kBAAkB,GAA0C,IAAI;;AAEpE;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,oCAAoC,CAAC,OAAO,EAA0C;AACtG,EAAE,MAAM,IAAA,GAAO,OAAO;AACtB,EAAEA,mBAAU,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,EAAEC,wBAAe,CAAC,IAAI,EAAE,eAAe,CAAC;AACxC;;AAEA,SAAS,eAAe,GAAS;AACjC,EAAE,kBAAA,GAAqBC,oBAAU,CAAC,OAAO;;AAEzC;AACA;AACA,EAAEA,oBAAU,CAAC,OAAA,GAAU;AACvB,IAAI,GAAG;AACP,IAAI,GAAG;AACP,IAAI,IAAI;AACR,IAAI,MAAM;AACV,IAAI,KAAK;AACT,IAAa;AACb,IAAI,MAAM,WAAW,GAAqB;AAC1C,MAAM,MAAM;AACZ,MAAM,KAAK;AACX,MAAM,IAAI;AACV,MAAM,GAAG;AACT,MAAM,GAAG;AACT,KAAK;AACL,IAAIC,wBAAe,CAAC,OAAO,EAAE,WAAW,CAAC;;AAEzC,IAAI,IAAI,kBAAkB,EAAE;AAC5B;AACA,MAAM,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC;AACtD;;AAEA,IAAI,OAAO,KAAK;AAChB,GAAG;;AAEH,EAAED,oBAAU,CAAC,OAAO,CAAC,uBAAA,GAA0B,IAAI;AACnD;;;;"}
|
||||
43
dev/env/node_modules/@sentry/core/build/cjs/instrument/globalUnhandledRejection.js
generated
vendored
Executable file
43
dev/env/node_modules/@sentry/core/build/cjs/instrument/globalUnhandledRejection.js
generated
vendored
Executable file
@@ -0,0 +1,43 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const worldwide = require('../utils/worldwide.js');
|
||||
const handlers = require('./handlers.js');
|
||||
|
||||
let _oldOnUnhandledRejectionHandler = null;
|
||||
|
||||
/**
|
||||
* Add an instrumentation handler for when an unhandled promise rejection is captured.
|
||||
*
|
||||
* Use at your own risk, this might break without changelog notice, only used internally.
|
||||
* @hidden
|
||||
*/
|
||||
function addGlobalUnhandledRejectionInstrumentationHandler(
|
||||
handler,
|
||||
) {
|
||||
const type = 'unhandledrejection';
|
||||
handlers.addHandler(type, handler);
|
||||
handlers.maybeInstrument(type, instrumentUnhandledRejection);
|
||||
}
|
||||
|
||||
function instrumentUnhandledRejection() {
|
||||
_oldOnUnhandledRejectionHandler = worldwide.GLOBAL_OBJ.onunhandledrejection;
|
||||
|
||||
// Note: The reason we are doing window.onunhandledrejection instead of window.addEventListener('unhandledrejection')
|
||||
// is that we are using this handler in the Loader Script, to handle buffered rejections consistently
|
||||
worldwide.GLOBAL_OBJ.onunhandledrejection = function (e) {
|
||||
const handlerData = e;
|
||||
handlers.triggerHandlers('unhandledrejection', handlerData);
|
||||
|
||||
if (_oldOnUnhandledRejectionHandler) {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
return _oldOnUnhandledRejectionHandler.apply(this, arguments);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
worldwide.GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;
|
||||
}
|
||||
|
||||
exports.addGlobalUnhandledRejectionInstrumentationHandler = addGlobalUnhandledRejectionInstrumentationHandler;
|
||||
//# sourceMappingURL=globalUnhandledRejection.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/globalUnhandledRejection.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/globalUnhandledRejection.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"globalUnhandledRejection.js","sources":["../../../src/instrument/globalUnhandledRejection.ts"],"sourcesContent":["import type { HandlerDataUnhandledRejection } from '../types-hoist/instrument';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers';\n\nlet _oldOnUnhandledRejectionHandler: (typeof GLOBAL_OBJ)['onunhandledrejection'] | null = null;\n\n/**\n * Add an instrumentation handler for when an unhandled promise rejection is captured.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addGlobalUnhandledRejectionInstrumentationHandler(\n handler: (data: HandlerDataUnhandledRejection) => void,\n): void {\n const type = 'unhandledrejection';\n addHandler(type, handler);\n maybeInstrument(type, instrumentUnhandledRejection);\n}\n\nfunction instrumentUnhandledRejection(): void {\n _oldOnUnhandledRejectionHandler = GLOBAL_OBJ.onunhandledrejection;\n\n // Note: The reason we are doing window.onunhandledrejection instead of window.addEventListener('unhandledrejection')\n // is that we are using this handler in the Loader Script, to handle buffered rejections consistently\n GLOBAL_OBJ.onunhandledrejection = function (e: unknown): boolean {\n const handlerData: HandlerDataUnhandledRejection = e;\n triggerHandlers('unhandledrejection', handlerData);\n\n if (_oldOnUnhandledRejectionHandler) {\n // eslint-disable-next-line prefer-rest-params\n return _oldOnUnhandledRejectionHandler.apply(this, arguments);\n }\n\n return true;\n };\n\n GLOBAL_OBJ.onunhandledrejection.__SENTRY_INSTRUMENTED__ = true;\n}\n"],"names":["addHandler","maybeInstrument","GLOBAL_OBJ","triggerHandlers"],"mappings":";;;;;AAIA,IAAI,+BAA+B,GAAuD,IAAI;;AAE9F;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iDAAiD;AACjE,EAAE,OAAO;AACT,EAAQ;AACR,EAAE,MAAM,IAAA,GAAO,oBAAoB;AACnC,EAAEA,mBAAU,CAAC,IAAI,EAAE,OAAO,CAAC;AAC3B,EAAEC,wBAAe,CAAC,IAAI,EAAE,4BAA4B,CAAC;AACrD;;AAEA,SAAS,4BAA4B,GAAS;AAC9C,EAAE,+BAAA,GAAkCC,oBAAU,CAAC,oBAAoB;;AAEnE;AACA;AACA,EAAEA,oBAAU,CAAC,oBAAA,GAAuB,UAAU,CAAC,EAAoB;AACnE,IAAI,MAAM,WAAW,GAAkC,CAAC;AACxD,IAAIC,wBAAe,CAAC,oBAAoB,EAAE,WAAW,CAAC;;AAEtD,IAAI,IAAI,+BAA+B,EAAE;AACzC;AACA,MAAM,OAAO,+BAA+B,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC;AACnE;;AAEA,IAAI,OAAO,IAAI;AACf,GAAG;;AAEH,EAAED,oBAAU,CAAC,oBAAoB,CAAC,uBAAA,GAA0B,IAAI;AAChE;;;;"}
|
||||
63
dev/env/node_modules/@sentry/core/build/cjs/instrument/handlers.js
generated
vendored
Executable file
63
dev/env/node_modules/@sentry/core/build/cjs/instrument/handlers.js
generated
vendored
Executable file
@@ -0,0 +1,63 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const debugBuild = require('../debug-build.js');
|
||||
const debugLogger = require('../utils/debug-logger.js');
|
||||
const stacktrace = require('../utils/stacktrace.js');
|
||||
|
||||
// We keep the handlers globally
|
||||
const handlers = {};
|
||||
const instrumented = {};
|
||||
|
||||
/** Add a handler function. */
|
||||
function addHandler(type, handler) {
|
||||
handlers[type] = handlers[type] || [];
|
||||
(handlers[type] ).push(handler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset all instrumentation handlers.
|
||||
* This can be used by tests to ensure we have a clean slate of instrumentation handlers.
|
||||
*/
|
||||
function resetInstrumentationHandlers() {
|
||||
Object.keys(handlers).forEach(key => {
|
||||
handlers[key ] = undefined;
|
||||
});
|
||||
}
|
||||
|
||||
/** Maybe run an instrumentation function, unless it was already called. */
|
||||
function maybeInstrument(type, instrumentFn) {
|
||||
if (!instrumented[type]) {
|
||||
instrumented[type] = true;
|
||||
try {
|
||||
instrumentFn();
|
||||
} catch (e) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.error(`Error while instrumenting ${type}`, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Trigger handlers for a given instrumentation type. */
|
||||
function triggerHandlers(type, data) {
|
||||
const typeHandlers = type && handlers[type];
|
||||
if (!typeHandlers) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const handler of typeHandlers) {
|
||||
try {
|
||||
handler(data);
|
||||
} catch (e) {
|
||||
debugBuild.DEBUG_BUILD &&
|
||||
debugLogger.debug.error(
|
||||
`Error while triggering instrumentation handler.\nType: ${type}\nName: ${stacktrace.getFunctionName(handler)}\nError:`,
|
||||
e,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.addHandler = addHandler;
|
||||
exports.maybeInstrument = maybeInstrument;
|
||||
exports.resetInstrumentationHandlers = resetInstrumentationHandlers;
|
||||
exports.triggerHandlers = triggerHandlers;
|
||||
//# sourceMappingURL=handlers.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/handlers.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/instrument/handlers.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"handlers.js","sources":["../../../src/instrument/handlers.ts"],"sourcesContent":["import { DEBUG_BUILD } from '../debug-build';\nimport { debug } from '../utils/debug-logger';\nimport { getFunctionName } from '../utils/stacktrace';\n\nexport type InstrumentHandlerType =\n | 'console'\n | 'dom'\n | 'fetch'\n | 'fetch-body-resolved'\n | 'history'\n | 'xhr'\n | 'error'\n | 'unhandledrejection';\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type InstrumentHandlerCallback = (data: any) => void;\n\n// We keep the handlers globally\nconst handlers: { [key in InstrumentHandlerType]?: InstrumentHandlerCallback[] } = {};\nconst instrumented: { [key in InstrumentHandlerType]?: boolean } = {};\n\n/** Add a handler function. */\nexport function addHandler(type: InstrumentHandlerType, handler: InstrumentHandlerCallback): void {\n handlers[type] = handlers[type] || [];\n (handlers[type] as InstrumentHandlerCallback[]).push(handler);\n}\n\n/**\n * Reset all instrumentation handlers.\n * This can be used by tests to ensure we have a clean slate of instrumentation handlers.\n */\nexport function resetInstrumentationHandlers(): void {\n Object.keys(handlers).forEach(key => {\n handlers[key as InstrumentHandlerType] = undefined;\n });\n}\n\n/** Maybe run an instrumentation function, unless it was already called. */\nexport function maybeInstrument(type: InstrumentHandlerType, instrumentFn: () => void): void {\n if (!instrumented[type]) {\n instrumented[type] = true;\n try {\n instrumentFn();\n } catch (e) {\n DEBUG_BUILD && debug.error(`Error while instrumenting ${type}`, e);\n }\n }\n}\n\n/** Trigger handlers for a given instrumentation type. */\nexport function triggerHandlers(type: InstrumentHandlerType, data: unknown): void {\n const typeHandlers = type && handlers[type];\n if (!typeHandlers) {\n return;\n }\n\n for (const handler of typeHandlers) {\n try {\n handler(data);\n } catch (e) {\n DEBUG_BUILD &&\n debug.error(\n `Error while triggering instrumentation handler.\\nType: ${type}\\nName: ${getFunctionName(handler)}\\nError:`,\n e,\n );\n }\n }\n}\n"],"names":["DEBUG_BUILD","debug","getFunctionName"],"mappings":";;;;;;AAgBA;AACA,MAAM,QAAQ,GAAqE,EAAE;AACrF,MAAM,YAAY,GAAiD,EAAE;;AAErE;AACO,SAAS,UAAU,CAAC,IAAI,EAAyB,OAAO,EAAmC;AAClG,EAAE,QAAQ,CAAC,IAAI,CAAA,GAAI,QAAQ,CAAC,IAAI,CAAA,IAAK,EAAE;AACvC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAA,GAAkC,IAAI,CAAC,OAAO,CAAC;AAC/D;;AAEA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,GAAS;AACrD,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,GAAA,IAAO;AACvC,IAAI,QAAQ,CAAC,GAAA,EAAI,GAA4B,SAAS;AACtD,GAAG,CAAC;AACJ;;AAEA;AACO,SAAS,eAAe,CAAC,IAAI,EAAyB,YAAY,EAAoB;AAC7F,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC3B,IAAI,YAAY,CAAC,IAAI,CAAA,GAAI,IAAI;AAC7B,IAAI,IAAI;AACR,MAAM,YAAY,EAAE;AACpB,KAAI,CAAE,OAAO,CAAC,EAAE;AAChB,MAAMA,sBAAA,IAAeC,iBAAK,CAAC,KAAK,CAAC,CAAC,0BAA0B,EAAE,IAAI,CAAC,CAAA,EAAA,CAAA,CAAA;AACA;AACA;AACA;;AAEA;AACA,SAAA,eAAA,CAAA,IAAA,EAAA,IAAA,EAAA;AACA,EAAA,MAAA,YAAA,GAAA,IAAA,IAAA,QAAA,CAAA,IAAA,CAAA;AACA,EAAA,IAAA,CAAA,YAAA,EAAA;AACA,IAAA;AACA;;AAEA,EAAA,KAAA,MAAA,OAAA,IAAA,YAAA,EAAA;AACA,IAAA,IAAA;AACA,MAAA,OAAA,CAAA,IAAA,CAAA;AACA,KAAA,CAAA,OAAA,CAAA,EAAA;AACA,MAAAD,sBAAA;AACA,QAAAC,iBAAA,CAAA,KAAA;AACA,UAAA,CAAA,uDAAA,EAAA,IAAA,CAAA,QAAA,EAAAC,0BAAA,CAAA,OAAA,CAAA,CAAA,QAAA,CAAA;AACA,UAAA,CAAA;AACA,SAAA;AACA;AACA;AACA;;;;;;;"}
|
||||
156
dev/env/node_modules/@sentry/core/build/cjs/integration.js
generated
vendored
Executable file
156
dev/env/node_modules/@sentry/core/build/cjs/integration.js
generated
vendored
Executable file
@@ -0,0 +1,156 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('./currentScopes.js');
|
||||
const debugBuild = require('./debug-build.js');
|
||||
const debugLogger = require('./utils/debug-logger.js');
|
||||
|
||||
const installedIntegrations = [];
|
||||
|
||||
/** Map of integrations assigned to a client */
|
||||
|
||||
/**
|
||||
* Remove duplicates from the given array, preferring the last instance of any duplicate. Not guaranteed to
|
||||
* preserve the order of integrations in the array.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
function filterDuplicates(integrations) {
|
||||
const integrationsByName = {};
|
||||
|
||||
integrations.forEach((currentInstance) => {
|
||||
const { name } = currentInstance;
|
||||
|
||||
const existingInstance = integrationsByName[name];
|
||||
|
||||
// We want integrations later in the array to overwrite earlier ones of the same type, except that we never want a
|
||||
// default instance to overwrite an existing user instance
|
||||
if (existingInstance && !existingInstance.isDefaultInstance && currentInstance.isDefaultInstance) {
|
||||
return;
|
||||
}
|
||||
|
||||
integrationsByName[name] = currentInstance;
|
||||
});
|
||||
|
||||
return Object.values(integrationsByName);
|
||||
}
|
||||
|
||||
/** Gets integrations to install */
|
||||
function getIntegrationsToSetup(options) {
|
||||
const defaultIntegrations = options.defaultIntegrations || [];
|
||||
const userIntegrations = options.integrations;
|
||||
|
||||
// We flag default instances, so that later we can tell them apart from any user-created instances of the same class
|
||||
defaultIntegrations.forEach((integration) => {
|
||||
integration.isDefaultInstance = true;
|
||||
});
|
||||
|
||||
let integrations;
|
||||
|
||||
if (Array.isArray(userIntegrations)) {
|
||||
integrations = [...defaultIntegrations, ...userIntegrations];
|
||||
} else if (typeof userIntegrations === 'function') {
|
||||
const resolvedUserIntegrations = userIntegrations(defaultIntegrations);
|
||||
integrations = Array.isArray(resolvedUserIntegrations) ? resolvedUserIntegrations : [resolvedUserIntegrations];
|
||||
} else {
|
||||
integrations = defaultIntegrations;
|
||||
}
|
||||
|
||||
return filterDuplicates(integrations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a list of integration instances this installs them all. When `withDefaults` is set to `true` then all default
|
||||
* integrations are added unless they were already provided before.
|
||||
* @param integrations array of integration instances
|
||||
* @param withDefault should enable default integrations
|
||||
*/
|
||||
function setupIntegrations(client, integrations) {
|
||||
const integrationIndex = {};
|
||||
|
||||
integrations.forEach((integration) => {
|
||||
// guard against empty provided integrations
|
||||
if (integration) {
|
||||
setupIntegration(client, integration, integrationIndex);
|
||||
}
|
||||
});
|
||||
|
||||
return integrationIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the `afterAllSetup` hooks of the given integrations.
|
||||
*/
|
||||
function afterSetupIntegrations(client, integrations) {
|
||||
for (const integration of integrations) {
|
||||
// guard against empty provided integrations
|
||||
if (integration?.afterAllSetup) {
|
||||
integration.afterAllSetup(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Setup a single integration. */
|
||||
function setupIntegration(client, integration, integrationIndex) {
|
||||
if (integrationIndex[integration.name]) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log(`Integration skipped because it was already installed: ${integration.name}`);
|
||||
return;
|
||||
}
|
||||
integrationIndex[integration.name] = integration;
|
||||
|
||||
// `setupOnce` is only called the first time
|
||||
if (installedIntegrations.indexOf(integration.name) === -1 && typeof integration.setupOnce === 'function') {
|
||||
integration.setupOnce();
|
||||
installedIntegrations.push(integration.name);
|
||||
}
|
||||
|
||||
// `setup` is run for each client
|
||||
if (integration.setup && typeof integration.setup === 'function') {
|
||||
integration.setup(client);
|
||||
}
|
||||
|
||||
if (typeof integration.preprocessEvent === 'function') {
|
||||
const callback = integration.preprocessEvent.bind(integration) ;
|
||||
client.on('preprocessEvent', (event, hint) => callback(event, hint, client));
|
||||
}
|
||||
|
||||
if (typeof integration.processEvent === 'function') {
|
||||
const callback = integration.processEvent.bind(integration) ;
|
||||
|
||||
const processor = Object.assign((event, hint) => callback(event, hint, client), {
|
||||
id: integration.name,
|
||||
});
|
||||
|
||||
client.addEventProcessor(processor);
|
||||
}
|
||||
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log(`Integration installed: ${integration.name}`);
|
||||
}
|
||||
|
||||
/** Add an integration to the current scope's client. */
|
||||
function addIntegration(integration) {
|
||||
const client = currentScopes.getClient();
|
||||
|
||||
if (!client) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn(`Cannot add integration "${integration.name}" because no SDK Client is available.`);
|
||||
return;
|
||||
}
|
||||
|
||||
client.addIntegration(integration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Define an integration function that can be used to create an integration instance.
|
||||
* Note that this by design hides the implementation details of the integration, as they are considered internal.
|
||||
*/
|
||||
function defineIntegration(fn) {
|
||||
return fn;
|
||||
}
|
||||
|
||||
exports.addIntegration = addIntegration;
|
||||
exports.afterSetupIntegrations = afterSetupIntegrations;
|
||||
exports.defineIntegration = defineIntegration;
|
||||
exports.getIntegrationsToSetup = getIntegrationsToSetup;
|
||||
exports.installedIntegrations = installedIntegrations;
|
||||
exports.setupIntegration = setupIntegration;
|
||||
exports.setupIntegrations = setupIntegrations;
|
||||
//# sourceMappingURL=integration.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integration.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integration.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
83
dev/env/node_modules/@sentry/core/build/cjs/integrations/captureconsole.js
generated
vendored
Executable file
83
dev/env/node_modules/@sentry/core/build/cjs/integrations/captureconsole.js
generated
vendored
Executable file
@@ -0,0 +1,83 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('../currentScopes.js');
|
||||
const exports$1 = require('../exports.js');
|
||||
const console = require('../instrument/console.js');
|
||||
const integration = require('../integration.js');
|
||||
const debugLogger = require('../utils/debug-logger.js');
|
||||
const misc = require('../utils/misc.js');
|
||||
const severity = require('../utils/severity.js');
|
||||
const string = require('../utils/string.js');
|
||||
const worldwide = require('../utils/worldwide.js');
|
||||
|
||||
const INTEGRATION_NAME = 'CaptureConsole';
|
||||
|
||||
const _captureConsoleIntegration = ((options = {}) => {
|
||||
const levels = options.levels || debugLogger.CONSOLE_LEVELS;
|
||||
const handled = options.handled ?? true;
|
||||
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
setup(client) {
|
||||
if (!('console' in worldwide.GLOBAL_OBJ)) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.addConsoleInstrumentationHandler(({ args, level }) => {
|
||||
if (currentScopes.getClient() !== client || !levels.includes(level)) {
|
||||
return;
|
||||
}
|
||||
|
||||
consoleHandler(args, level, handled);
|
||||
});
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
/**
|
||||
* Send Console API calls as Sentry Events.
|
||||
*/
|
||||
const captureConsoleIntegration = integration.defineIntegration(_captureConsoleIntegration);
|
||||
|
||||
function consoleHandler(args, level, handled) {
|
||||
const captureContext = {
|
||||
level: severity.severityLevelFromString(level),
|
||||
extra: {
|
||||
arguments: args,
|
||||
},
|
||||
};
|
||||
|
||||
currentScopes.withScope(scope => {
|
||||
scope.addEventProcessor(event => {
|
||||
event.logger = 'console';
|
||||
|
||||
misc.addExceptionMechanism(event, {
|
||||
handled,
|
||||
type: 'console',
|
||||
});
|
||||
|
||||
return event;
|
||||
});
|
||||
|
||||
if (level === 'assert') {
|
||||
if (!args[0]) {
|
||||
const message = `Assertion failed: ${string.safeJoin(args.slice(1), ' ') || 'console.assert'}`;
|
||||
scope.setExtra('arguments', args.slice(1));
|
||||
exports$1.captureMessage(message, captureContext);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const error = args.find(arg => arg instanceof Error);
|
||||
if (error) {
|
||||
exports$1.captureException(error, captureContext);
|
||||
return;
|
||||
}
|
||||
|
||||
const message = string.safeJoin(args, ' ');
|
||||
exports$1.captureMessage(message, captureContext);
|
||||
});
|
||||
}
|
||||
|
||||
exports.captureConsoleIntegration = captureConsoleIntegration;
|
||||
//# sourceMappingURL=captureconsole.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/captureconsole.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/captureconsole.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"captureconsole.js","sources":["../../../src/integrations/captureconsole.ts"],"sourcesContent":["import { getClient, withScope } from '../currentScopes';\nimport { captureException, captureMessage } from '../exports';\nimport { addConsoleInstrumentationHandler } from '../instrument/console';\nimport { defineIntegration } from '../integration';\nimport type { CaptureContext } from '../scope';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport { CONSOLE_LEVELS } from '../utils/debug-logger';\nimport { addExceptionMechanism } from '../utils/misc';\nimport { severityLevelFromString } from '../utils/severity';\nimport { safeJoin } from '../utils/string';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\n\ninterface CaptureConsoleOptions {\n levels?: string[];\n\n /**\n * By default, Sentry will mark captured console messages as handled.\n * Set this to `false` if you want to mark them as unhandled instead.\n *\n * @default true\n */\n handled?: boolean;\n}\n\nconst INTEGRATION_NAME = 'CaptureConsole';\n\nconst _captureConsoleIntegration = ((options: CaptureConsoleOptions = {}) => {\n const levels = options.levels || CONSOLE_LEVELS;\n const handled = options.handled ?? true;\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n addConsoleInstrumentationHandler(({ args, level }) => {\n if (getClient() !== client || !levels.includes(level)) {\n return;\n }\n\n consoleHandler(args, level, handled);\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Send Console API calls as Sentry Events.\n */\nexport const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration);\n\nfunction consoleHandler(args: unknown[], level: string, handled: boolean): void {\n const captureContext: CaptureContext = {\n level: severityLevelFromString(level),\n extra: {\n arguments: args,\n },\n };\n\n withScope(scope => {\n scope.addEventProcessor(event => {\n event.logger = 'console';\n\n addExceptionMechanism(event, {\n handled,\n type: 'console',\n });\n\n return event;\n });\n\n if (level === 'assert') {\n if (!args[0]) {\n const message = `Assertion failed: ${safeJoin(args.slice(1), ' ') || 'console.assert'}`;\n scope.setExtra('arguments', args.slice(1));\n captureMessage(message, captureContext);\n }\n return;\n }\n\n const error = args.find(arg => arg instanceof Error);\n if (error) {\n captureException(error, captureContext);\n return;\n }\n\n const message = safeJoin(args, ' ');\n captureMessage(message, captureContext);\n });\n}\n"],"names":["CONSOLE_LEVELS","GLOBAL_OBJ","addConsoleInstrumentationHandler","getClient","defineIntegration","severityLevelFromString","withScope","addExceptionMechanism","safeJoin","captureMessage","captureException"],"mappings":";;;;;;;;;;;;AAwBA,MAAM,gBAAA,GAAmB,gBAAgB;;AAEzC,MAAM,0BAAA,IAA8B,CAAC,OAAO,GAA0B,EAAE,KAAK;AAC7E,EAAE,MAAM,MAAA,GAAS,OAAO,CAAC,MAAA,IAAUA,0BAAc;AACjD,EAAE,MAAM,OAAA,GAAU,OAAO,CAAC,OAAA,IAAW,IAAI;;AAEzC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,IAAI,EAAE,aAAaC,oBAAU,CAAC,EAAE;AACtC,QAAQ;AACR;;AAEA,MAAMC,wCAAgC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAA,EAAO,KAAK;AAC5D,QAAQ,IAAIC,uBAAS,OAAO,MAAA,IAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AAC/D,UAAU;AACV;;AAEA,QAAQ,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC;AAC5C,OAAO,CAAC;AACR,KAAK;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;MACa,yBAAA,GAA4BC,6BAAiB,CAAC,0BAA0B;;AAErF,SAAS,cAAc,CAAC,IAAI,EAAa,KAAK,EAAU,OAAO,EAAiB;AAChF,EAAE,MAAM,cAAc,GAAmB;AACzC,IAAI,KAAK,EAAEC,gCAAuB,CAAC,KAAK,CAAC;AACzC,IAAI,KAAK,EAAE;AACX,MAAM,SAAS,EAAE,IAAI;AACrB,KAAK;AACL,GAAG;;AAEH,EAAEC,uBAAS,CAAC,KAAA,IAAS;AACrB,IAAI,KAAK,CAAC,iBAAiB,CAAC,SAAS;AACrC,MAAM,KAAK,CAAC,MAAA,GAAS,SAAS;;AAE9B,MAAMC,0BAAqB,CAAC,KAAK,EAAE;AACnC,QAAQ,OAAO;AACf,QAAQ,IAAI,EAAE,SAAS;AACvB,OAAO,CAAC;;AAER,MAAM,OAAO,KAAK;AAClB,KAAK,CAAC;;AAEN,IAAI,IAAI,KAAA,KAAU,QAAQ,EAAE;AAC5B,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AACpB,QAAQ,MAAM,UAAU,CAAC,kBAAkB,EAAEC,eAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,gBAAgB,CAAC,CAAA;AACA,QAAA,KAAA,CAAA,QAAA,CAAA,WAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA;AACA,QAAAC,wBAAA,CAAA,OAAA,EAAA,cAAA,CAAA;AACA;AACA,MAAA;AACA;;AAEA,IAAA,MAAA,KAAA,GAAA,IAAA,CAAA,IAAA,CAAA,GAAA,IAAA,GAAA,YAAA,KAAA,CAAA;AACA,IAAA,IAAA,KAAA,EAAA;AACA,MAAAC,0BAAA,CAAA,KAAA,EAAA,cAAA,CAAA;AACA,MAAA;AACA;;AAEA,IAAA,MAAA,OAAA,GAAAF,eAAA,CAAA,IAAA,EAAA,GAAA,CAAA;AACA,IAAAC,wBAAA,CAAA,OAAA,EAAA,cAAA,CAAA;AACA,GAAA,CAAA;AACA;;;;"}
|
||||
88
dev/env/node_modules/@sentry/core/build/cjs/integrations/console.js
generated
vendored
Executable file
88
dev/env/node_modules/@sentry/core/build/cjs/integrations/console.js
generated
vendored
Executable file
@@ -0,0 +1,88 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const breadcrumbs = require('../breadcrumbs.js');
|
||||
const currentScopes = require('../currentScopes.js');
|
||||
const console = require('../instrument/console.js');
|
||||
const integration = require('../integration.js');
|
||||
const debugLogger = require('../utils/debug-logger.js');
|
||||
const severity = require('../utils/severity.js');
|
||||
const string = require('../utils/string.js');
|
||||
const worldwide = require('../utils/worldwide.js');
|
||||
|
||||
const INTEGRATION_NAME = 'Console';
|
||||
|
||||
/**
|
||||
* Captures calls to the `console` API as breadcrumbs in Sentry.
|
||||
*
|
||||
* By default the integration instruments `console.debug`, `console.info`, `console.warn`, `console.error`,
|
||||
* `console.log`, `console.trace`, and `console.assert`. You can use the `levels` option to customize which
|
||||
* levels are captured.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```js
|
||||
* Sentry.init({
|
||||
* integrations: [Sentry.consoleIntegration({ levels: ['error', 'warn'] })],
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
const consoleIntegration = integration.defineIntegration((options = {}) => {
|
||||
const levels = new Set(options.levels || debugLogger.CONSOLE_LEVELS);
|
||||
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
setup(client) {
|
||||
console.addConsoleInstrumentationHandler(({ args, level }) => {
|
||||
if (currentScopes.getClient() !== client || !levels.has(level)) {
|
||||
return;
|
||||
}
|
||||
|
||||
addConsoleBreadcrumb(level, args);
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Capture a console breadcrumb.
|
||||
*
|
||||
* Exported just for tests.
|
||||
*/
|
||||
function addConsoleBreadcrumb(level, args) {
|
||||
const breadcrumb = {
|
||||
category: 'console',
|
||||
data: {
|
||||
arguments: args,
|
||||
logger: 'console',
|
||||
},
|
||||
level: severity.severityLevelFromString(level),
|
||||
message: formatConsoleArgs(args),
|
||||
};
|
||||
|
||||
if (level === 'assert') {
|
||||
if (args[0] === false) {
|
||||
const assertionArgs = args.slice(1);
|
||||
breadcrumb.message =
|
||||
assertionArgs.length > 0 ? `Assertion failed: ${formatConsoleArgs(assertionArgs)}` : 'Assertion failed';
|
||||
breadcrumb.data.arguments = assertionArgs;
|
||||
} else {
|
||||
// Don't capture a breadcrumb for passed assertions
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
breadcrumbs.addBreadcrumb(breadcrumb, {
|
||||
input: args,
|
||||
level,
|
||||
});
|
||||
}
|
||||
|
||||
function formatConsoleArgs(values) {
|
||||
return 'util' in worldwide.GLOBAL_OBJ && typeof (worldwide.GLOBAL_OBJ ).util.format === 'function'
|
||||
? (worldwide.GLOBAL_OBJ ).util.format(...values)
|
||||
: string.safeJoin(values, ' ');
|
||||
}
|
||||
|
||||
exports.addConsoleBreadcrumb = addConsoleBreadcrumb;
|
||||
exports.consoleIntegration = consoleIntegration;
|
||||
//# sourceMappingURL=console.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/console.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/console.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"console.js","sources":["../../../src/integrations/console.ts"],"sourcesContent":["import { addBreadcrumb } from '../breadcrumbs';\nimport { getClient } from '../currentScopes';\nimport { addConsoleInstrumentationHandler } from '../instrument/console';\nimport { defineIntegration } from '../integration';\nimport type { ConsoleLevel } from '../types-hoist/instrument';\nimport { CONSOLE_LEVELS } from '../utils/debug-logger';\nimport { severityLevelFromString } from '../utils/severity';\nimport { safeJoin } from '../utils/string';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\n\ninterface ConsoleIntegrationOptions {\n levels: ConsoleLevel[];\n}\n\ntype GlobalObjectWithUtil = typeof GLOBAL_OBJ & {\n util: {\n format: (...args: unknown[]) => string;\n };\n};\n\nconst INTEGRATION_NAME = 'Console';\n\n/**\n * Captures calls to the `console` API as breadcrumbs in Sentry.\n *\n * By default the integration instruments `console.debug`, `console.info`, `console.warn`, `console.error`,\n * `console.log`, `console.trace`, and `console.assert`. You can use the `levels` option to customize which\n * levels are captured.\n *\n * @example\n *\n * ```js\n * Sentry.init({\n * integrations: [Sentry.consoleIntegration({ levels: ['error', 'warn'] })],\n * });\n * ```\n */\nexport const consoleIntegration = defineIntegration((options: Partial<ConsoleIntegrationOptions> = {}) => {\n const levels = new Set(options.levels || CONSOLE_LEVELS);\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n addConsoleInstrumentationHandler(({ args, level }) => {\n if (getClient() !== client || !levels.has(level)) {\n return;\n }\n\n addConsoleBreadcrumb(level, args);\n });\n },\n };\n});\n\n/**\n * Capture a console breadcrumb.\n *\n * Exported just for tests.\n */\nexport function addConsoleBreadcrumb(level: ConsoleLevel, args: unknown[]): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: args,\n logger: 'console',\n },\n level: severityLevelFromString(level),\n message: formatConsoleArgs(args),\n };\n\n if (level === 'assert') {\n if (args[0] === false) {\n const assertionArgs = args.slice(1);\n breadcrumb.message =\n assertionArgs.length > 0 ? `Assertion failed: ${formatConsoleArgs(assertionArgs)}` : 'Assertion failed';\n breadcrumb.data.arguments = assertionArgs;\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n addBreadcrumb(breadcrumb, {\n input: args,\n level,\n });\n}\n\nfunction formatConsoleArgs(values: unknown[]): string {\n return 'util' in GLOBAL_OBJ && typeof (GLOBAL_OBJ as GlobalObjectWithUtil).util.format === 'function'\n ? (GLOBAL_OBJ as GlobalObjectWithUtil).util.format(...values)\n : safeJoin(values, ' ');\n}\n"],"names":["defineIntegration","CONSOLE_LEVELS","addConsoleInstrumentationHandler","getClient","severityLevelFromString","addBreadcrumb","GLOBAL_OBJ","safeJoin"],"mappings":";;;;;;;;;;;AAoBA,MAAM,gBAAA,GAAmB,SAAS;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAA,GAAqBA,6BAAiB,CAAC,CAAC,OAAO,GAAuC,EAAE,KAAK;AAC1G,EAAE,MAAM,MAAA,GAAS,IAAI,GAAG,CAAC,OAAO,CAAC,MAAA,IAAUC,0BAAc,CAAC;;AAE1D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAMC,wCAAgC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAA,EAAO,KAAK;AAC5D,QAAQ,IAAIC,uBAAS,OAAO,MAAA,IAAU,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;AAC1D,UAAU;AACV;;AAEA,QAAQ,oBAAoB,CAAC,KAAK,EAAE,IAAI,CAAC;AACzC,OAAO,CAAC;AACR,KAAK;AACL,GAAG;AACH,CAAC;;AAED;AACA;AACA;AACA;AACA;AACO,SAAS,oBAAoB,CAAC,KAAK,EAAgB,IAAI,EAAmB;AACjF,EAAE,MAAM,aAAa;AACrB,IAAI,QAAQ,EAAE,SAAS;AACvB,IAAI,IAAI,EAAE;AACV,MAAM,SAAS,EAAE,IAAI;AACrB,MAAM,MAAM,EAAE,SAAS;AACvB,KAAK;AACL,IAAI,KAAK,EAAEC,gCAAuB,CAAC,KAAK,CAAC;AACzC,IAAI,OAAO,EAAE,iBAAiB,CAAC,IAAI,CAAC;AACpC,GAAG;;AAEH,EAAE,IAAI,KAAA,KAAU,QAAQ,EAAE;AAC1B,IAAI,IAAI,IAAI,CAAC,CAAC,CAAA,KAAM,KAAK,EAAE;AAC3B,MAAM,MAAM,gBAAgB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AACzC,MAAM,UAAU,CAAC,OAAA;AACjB,QAAQ,aAAa,CAAC,MAAA,GAAS,IAAI,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,aAAa,CAAC,CAAC,CAAA,GAAA,kBAAA;AACA,MAAA,UAAA,CAAA,IAAA,CAAA,SAAA,GAAA,aAAA;AACA,KAAA,MAAA;AACA;AACA,MAAA;AACA;AACA;;AAEA,EAAAC,yBAAA,CAAA,UAAA,EAAA;AACA,IAAA,KAAA,EAAA,IAAA;AACA,IAAA,KAAA;AACA,GAAA,CAAA;AACA;;AAEA,SAAA,iBAAA,CAAA,MAAA,EAAA;AACA,EAAA,OAAA,MAAA,IAAAC,oBAAA,IAAA,OAAA,CAAAA,oBAAA,GAAA,IAAA,CAAA,MAAA,KAAA;AACA,MAAA,CAAAA,oBAAA,GAAA,IAAA,CAAA,MAAA,CAAA,GAAA,MAAA;AACA,MAAAC,eAAA,CAAA,MAAA,EAAA,GAAA,CAAA;AACA;;;;;"}
|
||||
182
dev/env/node_modules/@sentry/core/build/cjs/integrations/dedupe.js
generated
vendored
Executable file
182
dev/env/node_modules/@sentry/core/build/cjs/integrations/dedupe.js
generated
vendored
Executable file
@@ -0,0 +1,182 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const debugBuild = require('../debug-build.js');
|
||||
const integration = require('../integration.js');
|
||||
const debugLogger = require('../utils/debug-logger.js');
|
||||
const stacktrace = require('../utils/stacktrace.js');
|
||||
|
||||
const INTEGRATION_NAME = 'Dedupe';
|
||||
|
||||
const _dedupeIntegration = (() => {
|
||||
let previousEvent;
|
||||
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
processEvent(currentEvent) {
|
||||
// We want to ignore any non-error type events, e.g. transactions or replays
|
||||
// These should never be deduped, and also not be compared against as _previousEvent.
|
||||
if (currentEvent.type) {
|
||||
return currentEvent;
|
||||
}
|
||||
|
||||
// Juuust in case something goes wrong
|
||||
try {
|
||||
if (_shouldDropEvent(currentEvent, previousEvent)) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('Event dropped due to being a duplicate of previously captured event.');
|
||||
return null;
|
||||
}
|
||||
} catch {} // eslint-disable-line no-empty
|
||||
|
||||
return (previousEvent = currentEvent);
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
/**
|
||||
* Deduplication filter.
|
||||
*/
|
||||
const dedupeIntegration = integration.defineIntegration(_dedupeIntegration);
|
||||
|
||||
/** only exported for tests. */
|
||||
function _shouldDropEvent(currentEvent, previousEvent) {
|
||||
if (!previousEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_isSameMessageEvent(currentEvent, previousEvent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_isSameExceptionEvent(currentEvent, previousEvent)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function _isSameMessageEvent(currentEvent, previousEvent) {
|
||||
const currentMessage = currentEvent.message;
|
||||
const previousMessage = previousEvent.message;
|
||||
|
||||
// If neither event has a message property, they were both exceptions, so bail out
|
||||
if (!currentMessage && !previousMessage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If only one event has a stacktrace, but not the other one, they are not the same
|
||||
if ((currentMessage && !previousMessage) || (!currentMessage && previousMessage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (currentMessage !== previousMessage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_isSameFingerprint(currentEvent, previousEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_isSameStacktrace(currentEvent, previousEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _isSameExceptionEvent(currentEvent, previousEvent) {
|
||||
const previousException = _getExceptionFromEvent(previousEvent);
|
||||
const currentException = _getExceptionFromEvent(currentEvent);
|
||||
|
||||
if (!previousException || !currentException) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (previousException.type !== currentException.type || previousException.value !== currentException.value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_isSameFingerprint(currentEvent, previousEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_isSameStacktrace(currentEvent, previousEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _isSameStacktrace(currentEvent, previousEvent) {
|
||||
let currentFrames = stacktrace.getFramesFromEvent(currentEvent);
|
||||
let previousFrames = stacktrace.getFramesFromEvent(previousEvent);
|
||||
|
||||
// If neither event has a stacktrace, they are assumed to be the same
|
||||
if (!currentFrames && !previousFrames) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If only one event has a stacktrace, but not the other one, they are not the same
|
||||
if ((currentFrames && !previousFrames) || (!currentFrames && previousFrames)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
currentFrames = currentFrames ;
|
||||
previousFrames = previousFrames ;
|
||||
|
||||
// If number of frames differ, they are not the same
|
||||
if (previousFrames.length !== currentFrames.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Otherwise, compare the two
|
||||
for (let i = 0; i < previousFrames.length; i++) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const frameA = previousFrames[i];
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const frameB = currentFrames[i];
|
||||
|
||||
if (
|
||||
frameA.filename !== frameB.filename ||
|
||||
frameA.lineno !== frameB.lineno ||
|
||||
frameA.colno !== frameB.colno ||
|
||||
frameA.function !== frameB.function
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function _isSameFingerprint(currentEvent, previousEvent) {
|
||||
let currentFingerprint = currentEvent.fingerprint;
|
||||
let previousFingerprint = previousEvent.fingerprint;
|
||||
|
||||
// If neither event has a fingerprint, they are assumed to be the same
|
||||
if (!currentFingerprint && !previousFingerprint) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If only one event has a fingerprint, but not the other one, they are not the same
|
||||
if ((currentFingerprint && !previousFingerprint) || (!currentFingerprint && previousFingerprint)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
currentFingerprint = currentFingerprint ;
|
||||
previousFingerprint = previousFingerprint ;
|
||||
|
||||
// Otherwise, compare the two
|
||||
try {
|
||||
return !!(currentFingerprint.join('') === previousFingerprint.join(''));
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function _getExceptionFromEvent(event) {
|
||||
return event.exception?.values?.[0];
|
||||
}
|
||||
|
||||
exports._shouldDropEvent = _shouldDropEvent;
|
||||
exports.dedupeIntegration = dedupeIntegration;
|
||||
//# sourceMappingURL=dedupe.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/dedupe.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/dedupe.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
227
dev/env/node_modules/@sentry/core/build/cjs/integrations/eventFilters.js
generated
vendored
Executable file
227
dev/env/node_modules/@sentry/core/build/cjs/integrations/eventFilters.js
generated
vendored
Executable file
@@ -0,0 +1,227 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const debugBuild = require('../debug-build.js');
|
||||
const integration = require('../integration.js');
|
||||
const debugLogger = require('../utils/debug-logger.js');
|
||||
const eventUtils = require('../utils/eventUtils.js');
|
||||
const misc = require('../utils/misc.js');
|
||||
const string = require('../utils/string.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.$/, // The browser logs this when a ResizeObserver handler takes a bit longer. Usually this is not an actual issue though. It indicates slowness.
|
||||
/^Cannot redefine property: googletag$/, // This is thrown when google tag manager is used in combination with an ad blocker
|
||||
/^Can't find variable: gmo$/, // Error from Google Search App https://issuetracker.google.com/issues/396043331
|
||||
/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/, // Random error that happens but not actionable or noticeable to end-users.
|
||||
'can\'t redefine non-configurable property "solana"', // Probably a browser extension or custom browser (Brave) throwing this error
|
||||
"vv().getRestrictions is not a function. (In 'vv().getRestrictions(1,a)', 'vv().getRestrictions' is undefined)", // Error thrown by GTM, seemingly not affecting end-users
|
||||
"Can't find variable: _AutofillCallbackHandler", // Unactionable error in instagram webview https://developers.facebook.com/community/threads/320013549791141/
|
||||
/^Non-Error promise rejection captured with value: Object Not Found Matching Id:\d+, MethodName:simulateEvent, ParamCount:\d+$/, // unactionable error from CEFSharp, a .NET library that embeds chromium in .NET apps
|
||||
/^Java exception was raised during method invocation$/, // error from Facebook Mobile browser (https://github.com/getsentry/sentry-javascript/issues/15065)
|
||||
];
|
||||
|
||||
/** Options for the EventFilters integration */
|
||||
|
||||
const INTEGRATION_NAME = 'EventFilters';
|
||||
|
||||
/**
|
||||
* An integration that filters out events (errors and transactions) based on:
|
||||
*
|
||||
* - (Errors) A curated list of known low-value or irrelevant errors (see {@link DEFAULT_IGNORE_ERRORS})
|
||||
* - (Errors) A list of error messages or urls/filenames passed in via
|
||||
* - Top level Sentry.init options (`ignoreErrors`, `denyUrls`, `allowUrls`)
|
||||
* - The same options passed to the integration directly via @param options
|
||||
* - (Transactions/Spans) A list of root span (transaction) names passed in via
|
||||
* - Top level Sentry.init option (`ignoreTransactions`)
|
||||
* - The same option passed to the integration directly via @param options
|
||||
*
|
||||
* Events filtered by this integration will not be sent to Sentry.
|
||||
*/
|
||||
const eventFiltersIntegration = integration.defineIntegration((options = {}) => {
|
||||
let mergedOptions;
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
setup(client) {
|
||||
const clientOptions = client.getOptions();
|
||||
mergedOptions = _mergeOptions(options, clientOptions);
|
||||
},
|
||||
processEvent(event, _hint, client) {
|
||||
if (!mergedOptions) {
|
||||
const clientOptions = client.getOptions();
|
||||
mergedOptions = _mergeOptions(options, clientOptions);
|
||||
}
|
||||
return _shouldDropEvent(event, mergedOptions) ? null : event;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* An integration that filters out events (errors and transactions) based on:
|
||||
*
|
||||
* - (Errors) A curated list of known low-value or irrelevant errors (see {@link DEFAULT_IGNORE_ERRORS})
|
||||
* - (Errors) A list of error messages or urls/filenames passed in via
|
||||
* - Top level Sentry.init options (`ignoreErrors`, `denyUrls`, `allowUrls`)
|
||||
* - The same options passed to the integration directly via @param options
|
||||
* - (Transactions/Spans) A list of root span (transaction) names passed in via
|
||||
* - Top level Sentry.init option (`ignoreTransactions`)
|
||||
* - The same option passed to the integration directly via @param options
|
||||
*
|
||||
* Events filtered by this integration will not be sent to Sentry.
|
||||
*
|
||||
* @deprecated this integration was renamed and will be removed in a future major version.
|
||||
* Use `eventFiltersIntegration` instead.
|
||||
*/
|
||||
const inboundFiltersIntegration = integration.defineIntegration(((options = {}) => {
|
||||
return {
|
||||
...eventFiltersIntegration(options),
|
||||
name: 'InboundFilters',
|
||||
};
|
||||
}) );
|
||||
|
||||
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 || [])],
|
||||
};
|
||||
}
|
||||
|
||||
function _shouldDropEvent(event, options) {
|
||||
if (!event.type) {
|
||||
// Filter errors
|
||||
if (_isIgnoredError(event, options.ignoreErrors)) {
|
||||
debugBuild.DEBUG_BUILD &&
|
||||
debugLogger.debug.warn(
|
||||
`Event dropped due to being matched by \`ignoreErrors\` option.\nEvent: ${misc.getEventDescription(event)}`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (_isUselessError(event)) {
|
||||
debugBuild.DEBUG_BUILD &&
|
||||
debugLogger.debug.warn(
|
||||
`Event dropped due to not having an error message, error type or stacktrace.\nEvent: ${misc.getEventDescription(
|
||||
event,
|
||||
)}`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (_isDeniedUrl(event, options.denyUrls)) {
|
||||
debugBuild.DEBUG_BUILD &&
|
||||
debugLogger.debug.warn(
|
||||
`Event dropped due to being matched by \`denyUrls\` option.\nEvent: ${misc.getEventDescription(
|
||||
event,
|
||||
)}.\nUrl: ${_getEventFilterUrl(event)}`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
if (!_isAllowedUrl(event, options.allowUrls)) {
|
||||
debugBuild.DEBUG_BUILD &&
|
||||
debugLogger.debug.warn(
|
||||
`Event dropped due to not being matched by \`allowUrls\` option.\nEvent: ${misc.getEventDescription(
|
||||
event,
|
||||
)}.\nUrl: ${_getEventFilterUrl(event)}`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
} else if (event.type === 'transaction') {
|
||||
// Filter transactions
|
||||
|
||||
if (_isIgnoredTransaction(event, options.ignoreTransactions)) {
|
||||
debugBuild.DEBUG_BUILD &&
|
||||
debugLogger.debug.warn(
|
||||
`Event dropped due to being matched by \`ignoreTransactions\` option.\nEvent: ${misc.getEventDescription(event)}`,
|
||||
);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function _isIgnoredError(event, ignoreErrors) {
|
||||
if (!ignoreErrors?.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return eventUtils.getPossibleEventMessages(event).some(message => string.stringMatchesSomePattern(message, ignoreErrors));
|
||||
}
|
||||
|
||||
function _isIgnoredTransaction(event, ignoreTransactions) {
|
||||
if (!ignoreTransactions?.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const name = event.transaction;
|
||||
return name ? string.stringMatchesSomePattern(name, ignoreTransactions) : false;
|
||||
}
|
||||
|
||||
function _isDeniedUrl(event, denyUrls) {
|
||||
if (!denyUrls?.length) {
|
||||
return false;
|
||||
}
|
||||
const url = _getEventFilterUrl(event);
|
||||
return !url ? false : string.stringMatchesSomePattern(url, denyUrls);
|
||||
}
|
||||
|
||||
function _isAllowedUrl(event, allowUrls) {
|
||||
if (!allowUrls?.length) {
|
||||
return true;
|
||||
}
|
||||
const url = _getEventFilterUrl(event);
|
||||
return !url ? true : string.stringMatchesSomePattern(url, allowUrls);
|
||||
}
|
||||
|
||||
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 {
|
||||
// If there are linked exceptions or exception aggregates we only want to match against the top frame of the "root" (the main exception)
|
||||
// The root always comes last in linked exceptions
|
||||
const rootException = [...(event.exception?.values ?? [])]
|
||||
.reverse()
|
||||
.find(value => value.mechanism?.parent_id === undefined && value.stacktrace?.frames?.length);
|
||||
const frames = rootException?.stacktrace?.frames;
|
||||
return frames ? _getLastValidUrl(frames) : null;
|
||||
} catch {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.error(`Cannot extract url for event ${misc.getEventDescription(event)}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function _isUselessError(event) {
|
||||
// We only want to consider events for dropping that actually have recorded exception values.
|
||||
if (!event.exception?.values?.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
// No top-level message
|
||||
!event.message &&
|
||||
// There are no exception values that have a stacktrace, a non-generic-Error type or value
|
||||
!event.exception.values.some(value => value.stacktrace || (value.type && value.type !== 'Error') || value.value)
|
||||
);
|
||||
}
|
||||
|
||||
exports.eventFiltersIntegration = eventFiltersIntegration;
|
||||
exports.inboundFiltersIntegration = inboundFiltersIntegration;
|
||||
//# sourceMappingURL=eventFilters.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/eventFilters.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/eventFilters.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
124
dev/env/node_modules/@sentry/core/build/cjs/integrations/extraerrordata.js
generated
vendored
Executable file
124
dev/env/node_modules/@sentry/core/build/cjs/integrations/extraerrordata.js
generated
vendored
Executable file
@@ -0,0 +1,124 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const debugBuild = require('../debug-build.js');
|
||||
const integration = require('../integration.js');
|
||||
const debugLogger = require('../utils/debug-logger.js');
|
||||
const is = require('../utils/is.js');
|
||||
const normalize = require('../utils/normalize.js');
|
||||
const object = require('../utils/object.js');
|
||||
const string = require('../utils/string.js');
|
||||
|
||||
const INTEGRATION_NAME = 'ExtraErrorData';
|
||||
|
||||
/**
|
||||
* Extract additional data for from original exceptions.
|
||||
*/
|
||||
const _extraErrorDataIntegration = ((options = {}) => {
|
||||
const { depth = 3, captureErrorCause = true } = options;
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
processEvent(event, hint, client) {
|
||||
const { maxValueLength = 250 } = client.getOptions();
|
||||
return _enhanceEventWithErrorData(event, hint, depth, captureErrorCause, maxValueLength);
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
const extraErrorDataIntegration = integration.defineIntegration(_extraErrorDataIntegration);
|
||||
|
||||
function _enhanceEventWithErrorData(
|
||||
event,
|
||||
hint = {},
|
||||
depth,
|
||||
captureErrorCause,
|
||||
maxValueLength,
|
||||
) {
|
||||
if (!hint.originalException || !is.isError(hint.originalException)) {
|
||||
return event;
|
||||
}
|
||||
const exceptionName = (hint.originalException ).name || hint.originalException.constructor.name;
|
||||
|
||||
const errorData = _extractErrorData(hint.originalException , captureErrorCause, maxValueLength);
|
||||
|
||||
if (errorData) {
|
||||
const contexts = {
|
||||
...event.contexts,
|
||||
};
|
||||
|
||||
const normalizedErrorData = normalize.normalize(errorData, depth);
|
||||
|
||||
if (is.isPlainObject(normalizedErrorData)) {
|
||||
// We mark the error data as "already normalized" here, because we don't want other normalization procedures to
|
||||
// potentially truncate the data we just already normalized, with a certain depth setting.
|
||||
object.addNonEnumerableProperty(normalizedErrorData, '__sentry_skip_normalization__', true);
|
||||
contexts[exceptionName] = normalizedErrorData;
|
||||
}
|
||||
|
||||
return {
|
||||
...event,
|
||||
contexts,
|
||||
};
|
||||
}
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract extra information from the Error object
|
||||
*/
|
||||
function _extractErrorData(
|
||||
error,
|
||||
captureErrorCause,
|
||||
maxValueLength,
|
||||
) {
|
||||
// We are trying to enhance already existing event, so no harm done if it won't succeed
|
||||
try {
|
||||
const nativeKeys = [
|
||||
'name',
|
||||
'message',
|
||||
'stack',
|
||||
'line',
|
||||
'column',
|
||||
'fileName',
|
||||
'lineNumber',
|
||||
'columnNumber',
|
||||
'toJSON',
|
||||
];
|
||||
|
||||
const extraErrorInfo = {};
|
||||
|
||||
// We want only enumerable properties, thus `getOwnPropertyNames` is redundant here, as we filter keys anyway.
|
||||
for (const key of Object.keys(error)) {
|
||||
if (nativeKeys.indexOf(key) !== -1) {
|
||||
continue;
|
||||
}
|
||||
const value = error[key];
|
||||
extraErrorInfo[key] = is.isError(value) || typeof value === 'string' ? string.truncate(`${value}`, maxValueLength) : value;
|
||||
}
|
||||
|
||||
// Error.cause is a standard property that is non enumerable, we therefore need to access it separately.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause
|
||||
if (captureErrorCause && error.cause !== undefined) {
|
||||
extraErrorInfo.cause = is.isError(error.cause) ? error.cause.toString() : error.cause;
|
||||
}
|
||||
|
||||
// Check if someone attached `toJSON` method to grab even more properties (eg. axios is doing that)
|
||||
if (typeof error.toJSON === 'function') {
|
||||
const serializedError = error.toJSON() ;
|
||||
|
||||
for (const key of Object.keys(serializedError)) {
|
||||
const value = serializedError[key];
|
||||
extraErrorInfo[key] = is.isError(value) ? value.toString() : value;
|
||||
}
|
||||
}
|
||||
|
||||
return extraErrorInfo;
|
||||
} catch (oO) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.error('Unable to extract extra data from the Error object:', oO);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
exports.extraErrorDataIntegration = extraErrorDataIntegration;
|
||||
//# sourceMappingURL=extraerrordata.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/extraerrordata.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/extraerrordata.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
46
dev/env/node_modules/@sentry/core/build/cjs/integrations/featureFlags/featureFlagsIntegration.js
generated
vendored
Executable file
46
dev/env/node_modules/@sentry/core/build/cjs/integrations/featureFlags/featureFlagsIntegration.js
generated
vendored
Executable file
@@ -0,0 +1,46 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const integration = require('../../integration.js');
|
||||
const featureFlags = require('../../utils/featureFlags.js');
|
||||
|
||||
/**
|
||||
* Sentry integration for buffering feature flag evaluations manually with an API, and
|
||||
* capturing them on error events and spans.
|
||||
*
|
||||
* See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.
|
||||
*
|
||||
* @example
|
||||
* ```
|
||||
* import * as Sentry from '@sentry/browser';
|
||||
* import { type FeatureFlagsIntegration } from '@sentry/browser';
|
||||
*
|
||||
* // Setup
|
||||
* Sentry.init(..., integrations: [Sentry.featureFlagsIntegration()])
|
||||
*
|
||||
* // Verify
|
||||
* const flagsIntegration = Sentry.getClient()?.getIntegrationByName<FeatureFlagsIntegration>('FeatureFlags');
|
||||
* if (flagsIntegration) {
|
||||
* flagsIntegration.addFeatureFlag('my-flag', true);
|
||||
* } else {
|
||||
* // check your setup
|
||||
* }
|
||||
* Sentry.captureException(Exception('broke')); // 'my-flag' should be captured to this Sentry event.
|
||||
* ```
|
||||
*/
|
||||
const featureFlagsIntegration = integration.defineIntegration(() => {
|
||||
return {
|
||||
name: 'FeatureFlags',
|
||||
|
||||
processEvent(event, _hint, _client) {
|
||||
return featureFlags._INTERNAL_copyFlagsFromScopeToEvent(event);
|
||||
},
|
||||
|
||||
addFeatureFlag(name, value) {
|
||||
featureFlags._INTERNAL_insertFlagToScope(name, value);
|
||||
featureFlags._INTERNAL_addFeatureFlagToActiveSpan(name, value);
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
exports.featureFlagsIntegration = featureFlagsIntegration;
|
||||
//# sourceMappingURL=featureFlagsIntegration.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/featureFlags/featureFlagsIntegration.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/featureFlags/featureFlagsIntegration.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"featureFlagsIntegration.js","sources":["../../../../src/integrations/featureFlags/featureFlagsIntegration.ts"],"sourcesContent":["import { type Client } from '../../client';\nimport { defineIntegration } from '../../integration';\nimport { type Event, type EventHint } from '../../types-hoist/event';\nimport { type Integration, type IntegrationFn } from '../../types-hoist/integration';\nimport {\n _INTERNAL_addFeatureFlagToActiveSpan,\n _INTERNAL_copyFlagsFromScopeToEvent,\n _INTERNAL_insertFlagToScope,\n} from '../../utils/featureFlags';\n\nexport interface FeatureFlagsIntegration extends Integration {\n addFeatureFlag: (name: string, value: unknown) => void;\n}\n\n/**\n * Sentry integration for buffering feature flag evaluations manually with an API, and\n * capturing them on error events and spans.\n *\n * See the [feature flag documentation](https://develop.sentry.dev/sdk/expected-features/#feature-flags) for more information.\n *\n * @example\n * ```\n * import * as Sentry from '@sentry/browser';\n * import { type FeatureFlagsIntegration } from '@sentry/browser';\n *\n * // Setup\n * Sentry.init(..., integrations: [Sentry.featureFlagsIntegration()])\n *\n * // Verify\n * const flagsIntegration = Sentry.getClient()?.getIntegrationByName<FeatureFlagsIntegration>('FeatureFlags');\n * if (flagsIntegration) {\n * flagsIntegration.addFeatureFlag('my-flag', true);\n * } else {\n * // check your setup\n * }\n * Sentry.captureException(Exception('broke')); // 'my-flag' should be captured to this Sentry event.\n * ```\n */\nexport const featureFlagsIntegration = defineIntegration(() => {\n return {\n name: 'FeatureFlags',\n\n processEvent(event: Event, _hint: EventHint, _client: Client): Event {\n return _INTERNAL_copyFlagsFromScopeToEvent(event);\n },\n\n addFeatureFlag(name: string, value: unknown): void {\n _INTERNAL_insertFlagToScope(name, value);\n _INTERNAL_addFeatureFlagToActiveSpan(name, value);\n },\n };\n}) as IntegrationFn<FeatureFlagsIntegration>;\n"],"names":["defineIntegration","_INTERNAL_copyFlagsFromScopeToEvent","_INTERNAL_insertFlagToScope","_INTERNAL_addFeatureFlagToActiveSpan"],"mappings":";;;;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,uBAAA,GAA0BA,6BAAiB,CAAC,MAAM;AAC/D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,cAAc;;AAExB,IAAI,YAAY,CAAC,KAAK,EAAS,KAAK,EAAa,OAAO,EAAiB;AACzE,MAAM,OAAOC,gDAAmC,CAAC,KAAK,CAAC;AACvD,KAAK;;AAEL,IAAI,cAAc,CAAC,IAAI,EAAU,KAAK,EAAiB;AACvD,MAAMC,wCAA2B,CAAC,IAAI,EAAE,KAAK,CAAC;AAC9C,MAAMC,iDAAoC,CAAC,IAAI,EAAE,KAAK,CAAC;AACvD,KAAK;AACL,GAAG;AACH,CAAC,CAAA;;;;"}
|
||||
53
dev/env/node_modules/@sentry/core/build/cjs/integrations/functiontostring.js
generated
vendored
Executable file
53
dev/env/node_modules/@sentry/core/build/cjs/integrations/functiontostring.js
generated
vendored
Executable file
@@ -0,0 +1,53 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('../currentScopes.js');
|
||||
const integration = require('../integration.js');
|
||||
const object = require('../utils/object.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 {
|
||||
Function.prototype.toString = function ( ...args) {
|
||||
const originalFunction = object.getOriginalFunction(this);
|
||||
const context =
|
||||
SETUP_CLIENTS.has(currentScopes.getClient() ) && originalFunction !== undefined ? originalFunction : this;
|
||||
return originalFunctionToString.apply(context, args);
|
||||
};
|
||||
} catch {
|
||||
// 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 = integration.defineIntegration(_functionToStringIntegration);
|
||||
|
||||
exports.functionToStringIntegration = functionToStringIntegration;
|
||||
//# sourceMappingURL=functiontostring.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/functiontostring.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/functiontostring.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"functiontostring.js","sources":["../../../src/integrations/functiontostring.ts"],"sourcesContent":["import type { Client } from '../client';\nimport { getClient } from '../currentScopes';\nimport { defineIntegration } from '../integration';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport type { WrappedFunction } from '../types-hoist/wrappedfunction';\nimport { getOriginalFunction } from '../utils/object';\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 Function.prototype.toString = function (this: WrappedFunction, ...args: unknown[]): 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"],"names":["getOriginalFunction","getClient","defineIntegration"],"mappings":";;;;;;AAOA,IAAI,wBAAwB;;AAE5B,MAAM,gBAAA,GAAmB,kBAAkB;;AAE3C,MAAM,aAAA,GAAgB,IAAI,OAAO,EAAmB;;AAEpD,MAAM,4BAAA,IAAgC,MAAM;AAC5C,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,SAAS,GAAG;AAChB;AACA,MAAM,2BAA2B,QAAQ,CAAC,SAAS,CAAC,QAAQ;;AAE5D;AACA;AACA,MAAM,IAAI;AACV,QAAQ,QAAQ,CAAC,SAAS,CAAC,QAAA,GAAW,WAAiC,GAAG,IAAI,EAAqB;AACnG,UAAU,MAAM,gBAAA,GAAmBA,0BAAmB,CAAC,IAAI,CAAC;AAC5D,UAAU,MAAM,OAAA;AAChB,YAAY,aAAa,CAAC,GAAG,CAACC,uBAAS,EAAC,EAAE,IAAc,qBAAqB,SAAA,GAAY,gBAAA,GAAmB,IAAI;AAChH,UAAU,OAAO,wBAAwB,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC;AAC9D,SAAS;AACT,QAAQ,MAAM;AACd;AACA;AACA,KAAK;AACL,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC;AACrC,KAAK;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,2BAAA,GAA8BC,6BAAiB,CAAC,4BAA4B;;;;"}
|
||||
29
dev/env/node_modules/@sentry/core/build/cjs/integrations/linkederrors.js
generated
vendored
Executable file
29
dev/env/node_modules/@sentry/core/build/cjs/integrations/linkederrors.js
generated
vendored
Executable file
@@ -0,0 +1,29 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const integration = require('../integration.js');
|
||||
const aggregateErrors = require('../utils/aggregate-errors.js');
|
||||
const eventbuilder = require('../utils/eventbuilder.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,
|
||||
preprocessEvent(event, hint, client) {
|
||||
const options = client.getOptions();
|
||||
|
||||
aggregateErrors.applyAggregateErrorsToEvent(eventbuilder.exceptionFromError, options.stackParser, key, limit, event, hint);
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
const linkedErrorsIntegration = integration.defineIntegration(_linkedErrorsIntegration);
|
||||
|
||||
exports.linkedErrorsIntegration = linkedErrorsIntegration;
|
||||
//# sourceMappingURL=linkederrors.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/linkederrors.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/linkederrors.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"linkederrors.js","sources":["../../../src/integrations/linkederrors.ts"],"sourcesContent":["import { defineIntegration } from '../integration';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport { applyAggregateErrorsToEvent } from '../utils/aggregate-errors';\nimport { exceptionFromError } from '../utils/eventbuilder';\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 preprocessEvent(event, hint, client) {\n const options = client.getOptions();\n\n applyAggregateErrorsToEvent(exceptionFromError, options.stackParser, key, limit, event, hint);\n },\n };\n}) satisfies IntegrationFn;\n\nexport const linkedErrorsIntegration = defineIntegration(_linkedErrorsIntegration);\n"],"names":["applyAggregateErrorsToEvent","exceptionFromError","defineIntegration"],"mappings":";;;;;;AAUA,MAAM,WAAA,GAAc,OAAO;AAC3B,MAAM,aAAA,GAAgB,CAAC;;AAEvB,MAAM,gBAAA,GAAmB,cAAc;;AAEvC,MAAM,wBAAA,IAA4B,CAAC,OAAO,GAAwB,EAAE,KAAK;AACzE,EAAE,MAAM,KAAA,GAAQ,OAAO,CAAC,KAAA,IAAS,aAAa;AAC9C,EAAE,MAAM,GAAA,GAAM,OAAO,CAAC,GAAA,IAAO,WAAW;;AAExC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE;AACzC,MAAM,MAAM,OAAA,GAAU,MAAM,CAAC,UAAU,EAAE;;AAEzC,MAAMA,2CAA2B,CAACC,+BAAkB,EAAE,OAAO,CAAC,WAAW,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC;AACnG,KAAK;AACL,GAAG;AACH,CAAC,CAAA;;MAEY,uBAAA,GAA0BC,6BAAiB,CAAC,wBAAwB;;;;"}
|
||||
116
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/attributeExtraction.js
generated
vendored
Executable file
116
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/attributeExtraction.js
generated
vendored
Executable file
@@ -0,0 +1,116 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const url = require('../../utils/url.js');
|
||||
const attributes = require('./attributes.js');
|
||||
const methodConfig = require('./methodConfig.js');
|
||||
|
||||
/**
|
||||
* Core attribute extraction and building functions for MCP server instrumentation
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Extracts additional attributes for specific notification types
|
||||
* @param method - Notification method name
|
||||
* @param params - Notification parameters
|
||||
* @returns Method-specific attributes for span instrumentation
|
||||
*/
|
||||
function getNotificationAttributes(
|
||||
method,
|
||||
params,
|
||||
) {
|
||||
const attributes$1 = {};
|
||||
|
||||
switch (method) {
|
||||
case 'notifications/cancelled':
|
||||
if (params?.requestId) {
|
||||
attributes$1['mcp.cancelled.request_id'] = String(params.requestId);
|
||||
}
|
||||
if (params?.reason) {
|
||||
attributes$1['mcp.cancelled.reason'] = String(params.reason);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'notifications/message':
|
||||
if (params?.level) {
|
||||
attributes$1[attributes.MCP_LOGGING_LEVEL_ATTRIBUTE] = String(params.level);
|
||||
}
|
||||
if (params?.logger) {
|
||||
attributes$1[attributes.MCP_LOGGING_LOGGER_ATTRIBUTE] = String(params.logger);
|
||||
}
|
||||
if (params?.data !== undefined) {
|
||||
attributes$1[attributes.MCP_LOGGING_DATA_TYPE_ATTRIBUTE] = typeof params.data;
|
||||
if (typeof params.data === 'string') {
|
||||
attributes$1[attributes.MCP_LOGGING_MESSAGE_ATTRIBUTE] = params.data;
|
||||
} else {
|
||||
attributes$1[attributes.MCP_LOGGING_MESSAGE_ATTRIBUTE] = JSON.stringify(params.data);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'notifications/progress':
|
||||
if (params?.progressToken) {
|
||||
attributes$1['mcp.progress.token'] = String(params.progressToken);
|
||||
}
|
||||
if (typeof params?.progress === 'number') {
|
||||
attributes$1['mcp.progress.current'] = params.progress;
|
||||
}
|
||||
if (typeof params?.total === 'number') {
|
||||
attributes$1['mcp.progress.total'] = params.total;
|
||||
if (typeof params?.progress === 'number') {
|
||||
attributes$1['mcp.progress.percentage'] = (params.progress / params.total) * 100;
|
||||
}
|
||||
}
|
||||
if (params?.message) {
|
||||
attributes$1['mcp.progress.message'] = String(params.message);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'notifications/resources/updated':
|
||||
if (params?.uri) {
|
||||
attributes$1[attributes.MCP_RESOURCE_URI_ATTRIBUTE] = String(params.uri);
|
||||
const urlObject = url.parseStringToURLObject(String(params.uri));
|
||||
if (urlObject && !url.isURLObjectRelative(urlObject)) {
|
||||
attributes$1['mcp.resource.protocol'] = urlObject.protocol.replace(':', '');
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'notifications/initialized':
|
||||
attributes$1['mcp.lifecycle.phase'] = 'initialization_complete';
|
||||
attributes$1['mcp.protocol.ready'] = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return attributes$1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build type-specific attributes based on message type
|
||||
* @param type - Span type (request or notification)
|
||||
* @param message - JSON-RPC message
|
||||
* @param params - Optional parameters for attribute extraction
|
||||
* @returns Type-specific attributes for span instrumentation
|
||||
*/
|
||||
function buildTypeSpecificAttributes(
|
||||
type,
|
||||
message,
|
||||
params,
|
||||
) {
|
||||
if (type === 'request') {
|
||||
const request = message ;
|
||||
const targetInfo = methodConfig.extractTargetInfo(request.method, params || {});
|
||||
|
||||
return {
|
||||
...(request.id !== undefined && { [attributes.MCP_REQUEST_ID_ATTRIBUTE]: String(request.id) }),
|
||||
...targetInfo.attributes,
|
||||
...methodConfig.getRequestArguments(request.method, params || {}),
|
||||
};
|
||||
}
|
||||
|
||||
return getNotificationAttributes(message.method, params || {});
|
||||
}
|
||||
|
||||
exports.buildTypeSpecificAttributes = buildTypeSpecificAttributes;
|
||||
exports.getNotificationAttributes = getNotificationAttributes;
|
||||
//# sourceMappingURL=attributeExtraction.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/attributeExtraction.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/attributeExtraction.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
188
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/attributes.js
generated
vendored
Executable file
188
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/attributes.js
generated
vendored
Executable file
@@ -0,0 +1,188 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
/**
|
||||
* Essential MCP attribute constants for Sentry instrumentation
|
||||
*
|
||||
* Based on OpenTelemetry MCP semantic conventions
|
||||
* @see https://github.com/open-telemetry/semantic-conventions/blob/3097fb0af5b9492b0e3f55dc5f6c21a3dc2be8df/docs/gen-ai/mcp.md
|
||||
*/
|
||||
|
||||
// =============================================================================
|
||||
// CORE MCP ATTRIBUTES
|
||||
// =============================================================================
|
||||
|
||||
/** The name of the request or notification method */
|
||||
const MCP_METHOD_NAME_ATTRIBUTE = 'mcp.method.name';
|
||||
|
||||
/** JSON-RPC request identifier for the request. Unique within the MCP session. */
|
||||
const MCP_REQUEST_ID_ATTRIBUTE = 'mcp.request.id';
|
||||
|
||||
/** Identifies the MCP session */
|
||||
const MCP_SESSION_ID_ATTRIBUTE = 'mcp.session.id';
|
||||
|
||||
/** Transport method used for MCP communication */
|
||||
const MCP_TRANSPORT_ATTRIBUTE = 'mcp.transport';
|
||||
|
||||
// =============================================================================
|
||||
// SERVER ATTRIBUTES
|
||||
// =============================================================================
|
||||
|
||||
/** Name of the MCP server application */
|
||||
const MCP_SERVER_NAME_ATTRIBUTE = 'mcp.server.name';
|
||||
|
||||
/** Display title of the MCP server application */
|
||||
const MCP_SERVER_TITLE_ATTRIBUTE = 'mcp.server.title';
|
||||
|
||||
/** Version of the MCP server application */
|
||||
const MCP_SERVER_VERSION_ATTRIBUTE = 'mcp.server.version';
|
||||
|
||||
/** MCP protocol version used in the session */
|
||||
const MCP_PROTOCOL_VERSION_ATTRIBUTE = 'mcp.protocol.version';
|
||||
|
||||
// =============================================================================
|
||||
// METHOD-SPECIFIC ATTRIBUTES
|
||||
// =============================================================================
|
||||
|
||||
/** Name of the tool being called */
|
||||
const MCP_TOOL_NAME_ATTRIBUTE = 'mcp.tool.name';
|
||||
|
||||
/** The resource URI being accessed */
|
||||
const MCP_RESOURCE_URI_ATTRIBUTE = 'mcp.resource.uri';
|
||||
|
||||
/** Name of the prompt template */
|
||||
const MCP_PROMPT_NAME_ATTRIBUTE = 'mcp.prompt.name';
|
||||
|
||||
// =============================================================================
|
||||
// TOOL RESULT ATTRIBUTES
|
||||
// =============================================================================
|
||||
|
||||
/** Whether a tool execution resulted in an error */
|
||||
const MCP_TOOL_RESULT_IS_ERROR_ATTRIBUTE = 'mcp.tool.result.is_error';
|
||||
|
||||
/** Number of content items in the tool result */
|
||||
const MCP_TOOL_RESULT_CONTENT_COUNT_ATTRIBUTE = 'mcp.tool.result.content_count';
|
||||
|
||||
/** Serialized content of the tool result */
|
||||
const MCP_TOOL_RESULT_CONTENT_ATTRIBUTE = 'mcp.tool.result.content';
|
||||
|
||||
/** Prefix for tool result attributes that contain sensitive content */
|
||||
const MCP_TOOL_RESULT_PREFIX = 'mcp.tool.result';
|
||||
|
||||
// =============================================================================
|
||||
// PROMPT RESULT ATTRIBUTES
|
||||
// =============================================================================
|
||||
|
||||
/** Description of the prompt result */
|
||||
const MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE = 'mcp.prompt.result.description';
|
||||
|
||||
/** Number of messages in the prompt result */
|
||||
const MCP_PROMPT_RESULT_MESSAGE_COUNT_ATTRIBUTE = 'mcp.prompt.result.message_count';
|
||||
|
||||
/** Content of the message in the prompt result (for single message results) */
|
||||
const MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE = 'mcp.prompt.result.message_content';
|
||||
|
||||
/** Prefix for prompt result attributes that contain sensitive content */
|
||||
const MCP_PROMPT_RESULT_PREFIX = 'mcp.prompt.result';
|
||||
|
||||
// =============================================================================
|
||||
// REQUEST ARGUMENT ATTRIBUTES
|
||||
// =============================================================================
|
||||
|
||||
/** Prefix for MCP request argument prefix for each argument */
|
||||
const MCP_REQUEST_ARGUMENT = 'mcp.request.argument';
|
||||
|
||||
// =============================================================================
|
||||
// LOGGING ATTRIBUTES
|
||||
// =============================================================================
|
||||
|
||||
/** Log level for MCP logging operations */
|
||||
const MCP_LOGGING_LEVEL_ATTRIBUTE = 'mcp.logging.level';
|
||||
|
||||
/** Logger name for MCP logging operations */
|
||||
const MCP_LOGGING_LOGGER_ATTRIBUTE = 'mcp.logging.logger';
|
||||
|
||||
/** Data type of the logged message */
|
||||
const MCP_LOGGING_DATA_TYPE_ATTRIBUTE = 'mcp.logging.data_type';
|
||||
|
||||
/** Log message content */
|
||||
const MCP_LOGGING_MESSAGE_ATTRIBUTE = 'mcp.logging.message';
|
||||
|
||||
// =============================================================================
|
||||
// NETWORK ATTRIBUTES (OpenTelemetry Standard)
|
||||
// =============================================================================
|
||||
|
||||
/** OSI transport layer protocol */
|
||||
const NETWORK_TRANSPORT_ATTRIBUTE = 'network.transport';
|
||||
|
||||
/** The version of JSON RPC protocol used */
|
||||
const NETWORK_PROTOCOL_VERSION_ATTRIBUTE = 'network.protocol.version';
|
||||
|
||||
/** Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name */
|
||||
const CLIENT_ADDRESS_ATTRIBUTE = 'client.address';
|
||||
|
||||
/** Client port number */
|
||||
const CLIENT_PORT_ATTRIBUTE = 'client.port';
|
||||
|
||||
// =============================================================================
|
||||
// SENTRY-SPECIFIC MCP ATTRIBUTE VALUES
|
||||
// =============================================================================
|
||||
|
||||
/** Sentry operation value for MCP server spans */
|
||||
const MCP_SERVER_OP_VALUE = 'mcp.server';
|
||||
|
||||
/**
|
||||
* Sentry operation value for client-to-server notifications
|
||||
* Following OpenTelemetry MCP semantic conventions
|
||||
*/
|
||||
const MCP_NOTIFICATION_CLIENT_TO_SERVER_OP_VALUE = 'mcp.notification.client_to_server';
|
||||
|
||||
/**
|
||||
* Sentry operation value for server-to-client notifications
|
||||
* Following OpenTelemetry MCP semantic conventions
|
||||
*/
|
||||
const MCP_NOTIFICATION_SERVER_TO_CLIENT_OP_VALUE = 'mcp.notification.server_to_client';
|
||||
|
||||
/** Sentry origin value for MCP function spans */
|
||||
const MCP_FUNCTION_ORIGIN_VALUE = 'auto.function.mcp_server';
|
||||
|
||||
/** Sentry origin value for MCP notification spans */
|
||||
const MCP_NOTIFICATION_ORIGIN_VALUE = 'auto.mcp.notification';
|
||||
|
||||
/** Sentry source value for MCP route spans */
|
||||
const MCP_ROUTE_SOURCE_VALUE = 'route';
|
||||
|
||||
exports.CLIENT_ADDRESS_ATTRIBUTE = CLIENT_ADDRESS_ATTRIBUTE;
|
||||
exports.CLIENT_PORT_ATTRIBUTE = CLIENT_PORT_ATTRIBUTE;
|
||||
exports.MCP_FUNCTION_ORIGIN_VALUE = MCP_FUNCTION_ORIGIN_VALUE;
|
||||
exports.MCP_LOGGING_DATA_TYPE_ATTRIBUTE = MCP_LOGGING_DATA_TYPE_ATTRIBUTE;
|
||||
exports.MCP_LOGGING_LEVEL_ATTRIBUTE = MCP_LOGGING_LEVEL_ATTRIBUTE;
|
||||
exports.MCP_LOGGING_LOGGER_ATTRIBUTE = MCP_LOGGING_LOGGER_ATTRIBUTE;
|
||||
exports.MCP_LOGGING_MESSAGE_ATTRIBUTE = MCP_LOGGING_MESSAGE_ATTRIBUTE;
|
||||
exports.MCP_METHOD_NAME_ATTRIBUTE = MCP_METHOD_NAME_ATTRIBUTE;
|
||||
exports.MCP_NOTIFICATION_CLIENT_TO_SERVER_OP_VALUE = MCP_NOTIFICATION_CLIENT_TO_SERVER_OP_VALUE;
|
||||
exports.MCP_NOTIFICATION_ORIGIN_VALUE = MCP_NOTIFICATION_ORIGIN_VALUE;
|
||||
exports.MCP_NOTIFICATION_SERVER_TO_CLIENT_OP_VALUE = MCP_NOTIFICATION_SERVER_TO_CLIENT_OP_VALUE;
|
||||
exports.MCP_PROMPT_NAME_ATTRIBUTE = MCP_PROMPT_NAME_ATTRIBUTE;
|
||||
exports.MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE = MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE;
|
||||
exports.MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE = MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE;
|
||||
exports.MCP_PROMPT_RESULT_MESSAGE_COUNT_ATTRIBUTE = MCP_PROMPT_RESULT_MESSAGE_COUNT_ATTRIBUTE;
|
||||
exports.MCP_PROMPT_RESULT_PREFIX = MCP_PROMPT_RESULT_PREFIX;
|
||||
exports.MCP_PROTOCOL_VERSION_ATTRIBUTE = MCP_PROTOCOL_VERSION_ATTRIBUTE;
|
||||
exports.MCP_REQUEST_ARGUMENT = MCP_REQUEST_ARGUMENT;
|
||||
exports.MCP_REQUEST_ID_ATTRIBUTE = MCP_REQUEST_ID_ATTRIBUTE;
|
||||
exports.MCP_RESOURCE_URI_ATTRIBUTE = MCP_RESOURCE_URI_ATTRIBUTE;
|
||||
exports.MCP_ROUTE_SOURCE_VALUE = MCP_ROUTE_SOURCE_VALUE;
|
||||
exports.MCP_SERVER_NAME_ATTRIBUTE = MCP_SERVER_NAME_ATTRIBUTE;
|
||||
exports.MCP_SERVER_OP_VALUE = MCP_SERVER_OP_VALUE;
|
||||
exports.MCP_SERVER_TITLE_ATTRIBUTE = MCP_SERVER_TITLE_ATTRIBUTE;
|
||||
exports.MCP_SERVER_VERSION_ATTRIBUTE = MCP_SERVER_VERSION_ATTRIBUTE;
|
||||
exports.MCP_SESSION_ID_ATTRIBUTE = MCP_SESSION_ID_ATTRIBUTE;
|
||||
exports.MCP_TOOL_NAME_ATTRIBUTE = MCP_TOOL_NAME_ATTRIBUTE;
|
||||
exports.MCP_TOOL_RESULT_CONTENT_ATTRIBUTE = MCP_TOOL_RESULT_CONTENT_ATTRIBUTE;
|
||||
exports.MCP_TOOL_RESULT_CONTENT_COUNT_ATTRIBUTE = MCP_TOOL_RESULT_CONTENT_COUNT_ATTRIBUTE;
|
||||
exports.MCP_TOOL_RESULT_IS_ERROR_ATTRIBUTE = MCP_TOOL_RESULT_IS_ERROR_ATTRIBUTE;
|
||||
exports.MCP_TOOL_RESULT_PREFIX = MCP_TOOL_RESULT_PREFIX;
|
||||
exports.MCP_TRANSPORT_ATTRIBUTE = MCP_TRANSPORT_ATTRIBUTE;
|
||||
exports.NETWORK_PROTOCOL_VERSION_ATTRIBUTE = NETWORK_PROTOCOL_VERSION_ATTRIBUTE;
|
||||
exports.NETWORK_TRANSPORT_ATTRIBUTE = NETWORK_TRANSPORT_ATTRIBUTE;
|
||||
//# sourceMappingURL=attributes.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/attributes.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/attributes.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
115
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/correlation.js
generated
vendored
Executable file
115
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/correlation.js
generated
vendored
Executable file
@@ -0,0 +1,115 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('../../currentScopes.js');
|
||||
const spanstatus = require('../../tracing/spanstatus.js');
|
||||
const piiFiltering = require('./piiFiltering.js');
|
||||
const resultExtraction = require('./resultExtraction.js');
|
||||
|
||||
/**
|
||||
* Request-span correlation system for MCP server instrumentation
|
||||
*
|
||||
* Handles mapping requestId to span data for correlation with handler execution.
|
||||
* Uses WeakMap to scope correlation maps per transport instance, preventing
|
||||
* request ID collisions between different MCP sessions.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Transport-scoped correlation system that prevents collisions between different MCP sessions
|
||||
* @internal Each transport instance gets its own correlation map, eliminating request ID conflicts
|
||||
*/
|
||||
const transportToSpanMap = new WeakMap();
|
||||
|
||||
/**
|
||||
* Gets or creates the span map for a specific transport instance
|
||||
* @internal
|
||||
* @param transport - MCP transport instance
|
||||
* @returns Span map for the transport
|
||||
*/
|
||||
function getOrCreateSpanMap(transport) {
|
||||
let spanMap = transportToSpanMap.get(transport);
|
||||
if (!spanMap) {
|
||||
spanMap = new Map();
|
||||
transportToSpanMap.set(transport, spanMap);
|
||||
}
|
||||
return spanMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores span context for later correlation with handler execution
|
||||
* @param transport - MCP transport instance
|
||||
* @param requestId - Request identifier
|
||||
* @param span - Active span to correlate
|
||||
* @param method - MCP method name
|
||||
*/
|
||||
function storeSpanForRequest(transport, requestId, span, method) {
|
||||
const spanMap = getOrCreateSpanMap(transport);
|
||||
spanMap.set(requestId, {
|
||||
span,
|
||||
method,
|
||||
startTime: Date.now(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Completes span with tool results and cleans up correlation
|
||||
* @param transport - MCP transport instance
|
||||
* @param requestId - Request identifier
|
||||
* @param result - Tool execution result for attribute extraction
|
||||
*/
|
||||
function completeSpanWithResults(transport, requestId, result) {
|
||||
const spanMap = getOrCreateSpanMap(transport);
|
||||
const spanData = spanMap.get(requestId);
|
||||
if (spanData) {
|
||||
const { span, method } = spanData;
|
||||
|
||||
if (method === 'tools/call') {
|
||||
const rawToolAttributes = resultExtraction.extractToolResultAttributes(result);
|
||||
const client = currentScopes.getClient();
|
||||
const sendDefaultPii = Boolean(client?.getOptions().sendDefaultPii);
|
||||
const toolAttributes = piiFiltering.filterMcpPiiFromSpanData(rawToolAttributes, sendDefaultPii);
|
||||
|
||||
span.setAttributes(toolAttributes);
|
||||
} else if (method === 'prompts/get') {
|
||||
const rawPromptAttributes = resultExtraction.extractPromptResultAttributes(result);
|
||||
const client = currentScopes.getClient();
|
||||
const sendDefaultPii = Boolean(client?.getOptions().sendDefaultPii);
|
||||
const promptAttributes = piiFiltering.filterMcpPiiFromSpanData(rawPromptAttributes, sendDefaultPii);
|
||||
|
||||
span.setAttributes(promptAttributes);
|
||||
}
|
||||
|
||||
span.end();
|
||||
spanMap.delete(requestId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up pending spans for a specific transport (when that transport closes)
|
||||
* @param transport - MCP transport instance
|
||||
* @returns Number of pending spans that were cleaned up
|
||||
*/
|
||||
function cleanupPendingSpansForTransport(transport) {
|
||||
const spanMap = transportToSpanMap.get(transport);
|
||||
if (!spanMap) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const pendingCount = spanMap.size;
|
||||
|
||||
for (const [, spanData] of spanMap) {
|
||||
spanData.span.setStatus({
|
||||
code: spanstatus.SPAN_STATUS_ERROR,
|
||||
message: 'cancelled',
|
||||
});
|
||||
spanData.span.end();
|
||||
}
|
||||
|
||||
spanMap.clear();
|
||||
return pendingCount;
|
||||
}
|
||||
|
||||
exports.cleanupPendingSpansForTransport = cleanupPendingSpansForTransport;
|
||||
exports.completeSpanWithResults = completeSpanWithResults;
|
||||
exports.storeSpanForRequest = storeSpanForRequest;
|
||||
//# sourceMappingURL=correlation.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/correlation.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/correlation.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
55
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/errorCapture.js
generated
vendored
Executable file
55
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/errorCapture.js
generated
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('../../currentScopes.js');
|
||||
const exports$1 = require('../../exports.js');
|
||||
const spanUtils = require('../../utils/spanUtils.js');
|
||||
const spanstatus = require('../../tracing/spanstatus.js');
|
||||
|
||||
/**
|
||||
* Safe error capture utilities for MCP server instrumentation
|
||||
*
|
||||
* Ensures error reporting never interferes with MCP server operation.
|
||||
* All capture operations are wrapped in try-catch to prevent side effects.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Captures an error without affecting MCP server operation.
|
||||
*
|
||||
* The active span already contains all MCP context (method, tool, arguments, etc.)
|
||||
* @param error - Error to capture
|
||||
* @param errorType - Classification of error type for filtering
|
||||
* @param extraData - Additional context data to include
|
||||
*/
|
||||
function captureError(error, errorType, extraData) {
|
||||
try {
|
||||
const client = currentScopes.getClient();
|
||||
if (!client) {
|
||||
return;
|
||||
}
|
||||
|
||||
const activeSpan = spanUtils.getActiveSpan();
|
||||
if (activeSpan?.isRecording()) {
|
||||
activeSpan.setStatus({
|
||||
code: spanstatus.SPAN_STATUS_ERROR,
|
||||
message: 'internal_error',
|
||||
});
|
||||
}
|
||||
|
||||
exports$1.captureException(error, {
|
||||
mechanism: {
|
||||
type: 'mcp_server',
|
||||
handled: false,
|
||||
data: {
|
||||
error_type: errorType || 'handler_execution',
|
||||
...extraData,
|
||||
},
|
||||
},
|
||||
});
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
exports.captureError = captureError;
|
||||
//# sourceMappingURL=errorCapture.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/errorCapture.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/errorCapture.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"errorCapture.js","sources":["../../../../src/integrations/mcp-server/errorCapture.ts"],"sourcesContent":["/**\n * Safe error capture utilities for MCP server instrumentation\n *\n * Ensures error reporting never interferes with MCP server operation.\n * All capture operations are wrapped in try-catch to prevent side effects.\n */\n\nimport { getClient } from '../../currentScopes';\nimport { captureException } from '../../exports';\nimport { SPAN_STATUS_ERROR } from '../../tracing';\nimport { getActiveSpan } from '../../utils/spanUtils';\nimport type { McpErrorType } from './types';\n\n/**\n * Captures an error without affecting MCP server operation.\n *\n * The active span already contains all MCP context (method, tool, arguments, etc.)\n * @param error - Error to capture\n * @param errorType - Classification of error type for filtering\n * @param extraData - Additional context data to include\n */\nexport function captureError(error: Error, errorType?: McpErrorType, extraData?: Record<string, unknown>): void {\n try {\n const client = getClient();\n if (!client) {\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (activeSpan?.isRecording()) {\n activeSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: 'internal_error',\n });\n }\n\n captureException(error, {\n mechanism: {\n type: 'mcp_server',\n handled: false,\n data: {\n error_type: errorType || 'handler_execution',\n ...extraData,\n },\n },\n });\n } catch {\n // noop\n }\n}\n"],"names":["getClient","getActiveSpan","SPAN_STATUS_ERROR","captureException"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAY,CAAC,KAAK,EAAS,SAAS,EAAiB,SAAS,EAAkC;AAChH,EAAE,IAAI;AACN,IAAI,MAAM,MAAA,GAASA,uBAAS,EAAE;AAC9B,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,MAAM;AACN;;AAEA,IAAI,MAAM,UAAA,GAAaC,uBAAa,EAAE;AACtC,IAAI,IAAI,UAAU,EAAE,WAAW,EAAE,EAAE;AACnC,MAAM,UAAU,CAAC,SAAS,CAAC;AAC3B,QAAQ,IAAI,EAAEC,4BAAiB;AAC/B,QAAQ,OAAO,EAAE,gBAAgB;AACjC,OAAO,CAAC;AACR;;AAEA,IAAIC,0BAAgB,CAAC,KAAK,EAAE;AAC5B,MAAM,SAAS,EAAE;AACjB,QAAQ,IAAI,EAAE,YAAY;AAC1B,QAAQ,OAAO,EAAE,KAAK;AACtB,QAAQ,IAAI,EAAE;AACd,UAAU,UAAU,EAAE,SAAA,IAAa,mBAAmB;AACtD,UAAU,GAAG,SAAS;AACtB,SAAS;AACT,OAAO;AACP,KAAK,CAAC;AACN,IAAI,MAAM;AACV;AACA;AACA;;;;"}
|
||||
169
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/handlers.js
generated
vendored
Executable file
169
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/handlers.js
generated
vendored
Executable file
@@ -0,0 +1,169 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const debugBuild = require('../../debug-build.js');
|
||||
const debugLogger = require('../../utils/debug-logger.js');
|
||||
const object = require('../../utils/object.js');
|
||||
const errorCapture = require('./errorCapture.js');
|
||||
|
||||
/**
|
||||
* Handler method wrapping for MCP server instrumentation
|
||||
*
|
||||
* Provides automatic error capture and span correlation for tool, resource,
|
||||
* and prompt handlers.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Generic function to wrap MCP server method handlers
|
||||
* @internal
|
||||
* @param serverInstance - MCP server instance
|
||||
* @param methodName - Method name to wrap (tool, resource, prompt)
|
||||
*/
|
||||
function wrapMethodHandler(serverInstance, methodName) {
|
||||
object.fill(serverInstance, methodName, originalMethod => {
|
||||
return function ( name, ...args) {
|
||||
const handler = args[args.length - 1];
|
||||
|
||||
if (typeof handler !== 'function') {
|
||||
return (originalMethod ).call(this, name, ...args);
|
||||
}
|
||||
|
||||
const wrappedHandler = createWrappedHandler(handler , methodName, name);
|
||||
return (originalMethod ).call(this, name, ...args.slice(0, -1), wrappedHandler);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a wrapped handler with span correlation and error capture
|
||||
* @internal
|
||||
* @param originalHandler - Original handler function
|
||||
* @param methodName - MCP method name
|
||||
* @param handlerName - Handler identifier
|
||||
* @returns Wrapped handler function
|
||||
*/
|
||||
function createWrappedHandler(originalHandler, methodName, handlerName) {
|
||||
return function ( ...handlerArgs) {
|
||||
try {
|
||||
return createErrorCapturingHandler.call(this, originalHandler, methodName, handlerName, handlerArgs);
|
||||
} catch (error) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('MCP handler wrapping failed:', error);
|
||||
return originalHandler.apply(this, handlerArgs);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an error-capturing wrapper for handler execution
|
||||
* @internal
|
||||
* @param originalHandler - Original handler function
|
||||
* @param methodName - MCP method name
|
||||
* @param handlerName - Handler identifier
|
||||
* @param handlerArgs - Handler arguments
|
||||
* @param extraHandlerData - Additional handler context
|
||||
* @returns Handler execution result
|
||||
*/
|
||||
function createErrorCapturingHandler(
|
||||
|
||||
originalHandler,
|
||||
methodName,
|
||||
handlerName,
|
||||
handlerArgs,
|
||||
) {
|
||||
try {
|
||||
const result = originalHandler.apply(this, handlerArgs);
|
||||
|
||||
if (result && typeof result === 'object' && typeof (result ).then === 'function') {
|
||||
return Promise.resolve(result).catch(error => {
|
||||
captureHandlerError(error, methodName, handlerName);
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
} catch (error) {
|
||||
captureHandlerError(error , methodName, handlerName);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures handler execution errors based on handler type
|
||||
* @internal
|
||||
* @param error - Error to capture
|
||||
* @param methodName - MCP method name
|
||||
* @param handlerName - Handler identifier
|
||||
*/
|
||||
function captureHandlerError(error, methodName, handlerName) {
|
||||
try {
|
||||
const extraData = {};
|
||||
|
||||
if (methodName === 'tool') {
|
||||
extraData.tool_name = handlerName;
|
||||
|
||||
if (
|
||||
error.name === 'ProtocolValidationError' ||
|
||||
error.message.includes('validation') ||
|
||||
error.message.includes('protocol')
|
||||
) {
|
||||
errorCapture.captureError(error, 'validation', extraData);
|
||||
} else if (
|
||||
error.name === 'ServerTimeoutError' ||
|
||||
error.message.includes('timed out') ||
|
||||
error.message.includes('timeout')
|
||||
) {
|
||||
errorCapture.captureError(error, 'timeout', extraData);
|
||||
} else {
|
||||
errorCapture.captureError(error, 'tool_execution', extraData);
|
||||
}
|
||||
} else if (methodName === 'resource') {
|
||||
extraData.resource_uri = handlerName;
|
||||
errorCapture.captureError(error, 'resource_execution', extraData);
|
||||
} else if (methodName === 'prompt') {
|
||||
extraData.prompt_name = handlerName;
|
||||
errorCapture.captureError(error, 'prompt_execution', extraData);
|
||||
}
|
||||
} catch (captureErr) {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps tool handlers to associate them with request spans
|
||||
* @param serverInstance - MCP server instance
|
||||
*/
|
||||
function wrapToolHandlers(serverInstance) {
|
||||
wrapMethodHandler(serverInstance, 'tool');
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps resource handlers to associate them with request spans
|
||||
* @param serverInstance - MCP server instance
|
||||
*/
|
||||
function wrapResourceHandlers(serverInstance) {
|
||||
wrapMethodHandler(serverInstance, 'resource');
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps prompt handlers to associate them with request spans
|
||||
* @param serverInstance - MCP server instance
|
||||
*/
|
||||
function wrapPromptHandlers(serverInstance) {
|
||||
wrapMethodHandler(serverInstance, 'prompt');
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps all MCP handler types (tool, resource, prompt) for span correlation
|
||||
* @param serverInstance - MCP server instance
|
||||
*/
|
||||
function wrapAllMCPHandlers(serverInstance) {
|
||||
wrapToolHandlers(serverInstance);
|
||||
wrapResourceHandlers(serverInstance);
|
||||
wrapPromptHandlers(serverInstance);
|
||||
}
|
||||
|
||||
exports.wrapAllMCPHandlers = wrapAllMCPHandlers;
|
||||
exports.wrapPromptHandlers = wrapPromptHandlers;
|
||||
exports.wrapResourceHandlers = wrapResourceHandlers;
|
||||
exports.wrapToolHandlers = wrapToolHandlers;
|
||||
//# sourceMappingURL=handlers.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/handlers.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/handlers.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
72
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/index.js
generated
vendored
Executable file
72
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/index.js
generated
vendored
Executable file
@@ -0,0 +1,72 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const object = require('../../utils/object.js');
|
||||
const handlers = require('./handlers.js');
|
||||
const transport = require('./transport.js');
|
||||
const validation = require('./validation.js');
|
||||
|
||||
/**
|
||||
* Tracks wrapped MCP server instances to prevent double-wrapping
|
||||
* @internal
|
||||
*/
|
||||
const wrappedMcpServerInstances = new WeakSet();
|
||||
|
||||
/**
|
||||
* Wraps a MCP Server instance from the `@modelcontextprotocol/sdk` package with Sentry instrumentation.
|
||||
*
|
||||
* Compatible with versions `^1.9.0` of the `@modelcontextprotocol/sdk` package.
|
||||
* Automatically instruments transport methods and handler functions for comprehensive monitoring.
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import * as Sentry from '@sentry/core';
|
||||
* import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
||||
* import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
||||
*
|
||||
* const server = Sentry.wrapMcpServerWithSentry(
|
||||
* new McpServer({ name: "my-server", version: "1.0.0" })
|
||||
* );
|
||||
*
|
||||
* const transport = new StreamableHTTPServerTransport();
|
||||
* await server.connect(transport);
|
||||
* ```
|
||||
*
|
||||
* @param mcpServerInstance - MCP server instance to instrument
|
||||
* @returns Instrumented server instance (same reference)
|
||||
*/
|
||||
function wrapMcpServerWithSentry(mcpServerInstance) {
|
||||
if (wrappedMcpServerInstances.has(mcpServerInstance)) {
|
||||
return mcpServerInstance;
|
||||
}
|
||||
|
||||
if (!validation.validateMcpServerInstance(mcpServerInstance)) {
|
||||
return mcpServerInstance;
|
||||
}
|
||||
|
||||
const serverInstance = mcpServerInstance ;
|
||||
|
||||
object.fill(serverInstance, 'connect', originalConnect => {
|
||||
return async function ( transport$1, ...restArgs) {
|
||||
const result = await (originalConnect ).call(
|
||||
this,
|
||||
transport$1,
|
||||
...restArgs,
|
||||
);
|
||||
|
||||
transport.wrapTransportOnMessage(transport$1);
|
||||
transport.wrapTransportSend(transport$1);
|
||||
transport.wrapTransportOnClose(transport$1);
|
||||
transport.wrapTransportError(transport$1);
|
||||
|
||||
return result;
|
||||
};
|
||||
});
|
||||
|
||||
handlers.wrapAllMCPHandlers(serverInstance);
|
||||
|
||||
wrappedMcpServerInstances.add(mcpServerInstance);
|
||||
return mcpServerInstance ;
|
||||
}
|
||||
|
||||
exports.wrapMcpServerWithSentry = wrapMcpServerWithSentry;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/index.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/index.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../../src/integrations/mcp-server/index.ts"],"sourcesContent":["import { fill } from '../../utils/object';\nimport { wrapAllMCPHandlers } from './handlers';\nimport { wrapTransportError, wrapTransportOnClose, wrapTransportOnMessage, wrapTransportSend } from './transport';\nimport type { MCPServerInstance, MCPTransport } from './types';\nimport { validateMcpServerInstance } from './validation';\n\n/**\n * Tracks wrapped MCP server instances to prevent double-wrapping\n * @internal\n */\nconst wrappedMcpServerInstances = new WeakSet();\n\n/**\n * Wraps a MCP Server instance from the `@modelcontextprotocol/sdk` package with Sentry instrumentation.\n *\n * Compatible with versions `^1.9.0` of the `@modelcontextprotocol/sdk` package.\n * Automatically instruments transport methods and handler functions for comprehensive monitoring.\n *\n * @example\n * ```typescript\n * import * as Sentry from '@sentry/core';\n * import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n * import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';\n *\n * const server = Sentry.wrapMcpServerWithSentry(\n * new McpServer({ name: \"my-server\", version: \"1.0.0\" })\n * );\n *\n * const transport = new StreamableHTTPServerTransport();\n * await server.connect(transport);\n * ```\n *\n * @param mcpServerInstance - MCP server instance to instrument\n * @returns Instrumented server instance (same reference)\n */\nexport function wrapMcpServerWithSentry<S extends object>(mcpServerInstance: S): S {\n if (wrappedMcpServerInstances.has(mcpServerInstance)) {\n return mcpServerInstance;\n }\n\n if (!validateMcpServerInstance(mcpServerInstance)) {\n return mcpServerInstance;\n }\n\n const serverInstance = mcpServerInstance as MCPServerInstance;\n\n fill(serverInstance, 'connect', originalConnect => {\n return async function (this: MCPServerInstance, transport: MCPTransport, ...restArgs: unknown[]) {\n const result = await (originalConnect as (...args: unknown[]) => Promise<unknown>).call(\n this,\n transport,\n ...restArgs,\n );\n\n wrapTransportOnMessage(transport);\n wrapTransportSend(transport);\n wrapTransportOnClose(transport);\n wrapTransportError(transport);\n\n return result;\n };\n });\n\n wrapAllMCPHandlers(serverInstance);\n\n wrappedMcpServerInstances.add(mcpServerInstance);\n return mcpServerInstance as S;\n}\n"],"names":["validateMcpServerInstance","fill","transport","wrapTransportOnMessage","wrapTransportSend","wrapTransportOnClose","wrapTransportError","wrapAllMCPHandlers"],"mappings":";;;;;;;AAMA;AACA;AACA;AACA;AACA,MAAM,yBAAA,GAA4B,IAAI,OAAO,EAAE;;AAE/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAmB,iBAAiB,EAAQ;AACnF,EAAE,IAAI,yBAAyB,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;AACxD,IAAI,OAAO,iBAAiB;AAC5B;;AAEA,EAAE,IAAI,CAACA,oCAAyB,CAAC,iBAAiB,CAAC,EAAE;AACrD,IAAI,OAAO,iBAAiB;AAC5B;;AAEA,EAAE,MAAM,cAAA,GAAiB,iBAAA;;AAEzB,EAAEC,WAAI,CAAC,cAAc,EAAE,SAAS,EAAE,mBAAmB;AACrD,IAAI,OAAO,iBAAyCC,WAAS,EAAgB,GAAG,QAAQ,EAAa;AACrG,MAAM,MAAM,SAAS,MAAM,CAAC,eAAA,GAA6D,IAAI;AAC7F,QAAQ,IAAI;AACZ,QAAQA,WAAS;AACjB,QAAQ,GAAG,QAAQ;AACnB,OAAO;;AAEP,MAAMC,gCAAsB,CAACD,WAAS,CAAC;AACvC,MAAME,2BAAiB,CAACF,WAAS,CAAC;AAClC,MAAMG,8BAAoB,CAACH,WAAS,CAAC;AACrC,MAAMI,4BAAkB,CAACJ,WAAS,CAAC;;AAEnC,MAAM,OAAO,MAAM;AACnB,KAAK;AACL,GAAG,CAAC;;AAEJ,EAAEK,2BAAkB,CAAC,cAAc,CAAC;;AAEpC,EAAE,yBAAyB,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAClD,EAAE,OAAO,iBAAA;AACT;;;;"}
|
||||
107
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/methodConfig.js
generated
vendored
Executable file
107
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/methodConfig.js
generated
vendored
Executable file
@@ -0,0 +1,107 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const attributes = require('./attributes.js');
|
||||
|
||||
/**
|
||||
* Method configuration and request processing for MCP server instrumentation
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Configuration for MCP methods to extract targets and arguments
|
||||
* @internal Maps method names to their extraction configuration
|
||||
*/
|
||||
const METHOD_CONFIGS = {
|
||||
'tools/call': {
|
||||
targetField: 'name',
|
||||
targetAttribute: attributes.MCP_TOOL_NAME_ATTRIBUTE,
|
||||
captureArguments: true,
|
||||
argumentsField: 'arguments',
|
||||
},
|
||||
'resources/read': {
|
||||
targetField: 'uri',
|
||||
targetAttribute: attributes.MCP_RESOURCE_URI_ATTRIBUTE,
|
||||
captureUri: true,
|
||||
},
|
||||
'resources/subscribe': {
|
||||
targetField: 'uri',
|
||||
targetAttribute: attributes.MCP_RESOURCE_URI_ATTRIBUTE,
|
||||
},
|
||||
'resources/unsubscribe': {
|
||||
targetField: 'uri',
|
||||
targetAttribute: attributes.MCP_RESOURCE_URI_ATTRIBUTE,
|
||||
},
|
||||
'prompts/get': {
|
||||
targetField: 'name',
|
||||
targetAttribute: attributes.MCP_PROMPT_NAME_ATTRIBUTE,
|
||||
captureName: true,
|
||||
captureArguments: true,
|
||||
argumentsField: 'arguments',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Extracts target info from method and params based on method type
|
||||
* @param method - MCP method name
|
||||
* @param params - Method parameters
|
||||
* @returns Target name and attributes for span instrumentation
|
||||
*/
|
||||
function extractTargetInfo(
|
||||
method,
|
||||
params,
|
||||
)
|
||||
|
||||
{
|
||||
const config = METHOD_CONFIGS[method ];
|
||||
if (!config) {
|
||||
return { attributes: {} };
|
||||
}
|
||||
|
||||
const target =
|
||||
config.targetField && typeof params?.[config.targetField] === 'string'
|
||||
? (params[config.targetField] )
|
||||
: undefined;
|
||||
|
||||
return {
|
||||
target,
|
||||
attributes: target && config.targetAttribute ? { [config.targetAttribute]: target } : {},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts request arguments based on method type
|
||||
* @param method - MCP method name
|
||||
* @param params - Method parameters
|
||||
* @returns Arguments as span attributes with mcp.request.argument prefix
|
||||
*/
|
||||
function getRequestArguments(method, params) {
|
||||
const args = {};
|
||||
const config = METHOD_CONFIGS[method ];
|
||||
|
||||
if (!config) {
|
||||
return args;
|
||||
}
|
||||
|
||||
if (config.captureArguments && config.argumentsField && params?.[config.argumentsField]) {
|
||||
const argumentsObj = params[config.argumentsField];
|
||||
if (typeof argumentsObj === 'object' && argumentsObj !== null) {
|
||||
for (const [key, value] of Object.entries(argumentsObj )) {
|
||||
args[`${attributes.MCP_REQUEST_ARGUMENT}.${key.toLowerCase()}`] = JSON.stringify(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.captureUri && params?.uri) {
|
||||
args[`${attributes.MCP_REQUEST_ARGUMENT}.uri`] = JSON.stringify(params.uri);
|
||||
}
|
||||
|
||||
if (config.captureName && params?.name) {
|
||||
args[`${attributes.MCP_REQUEST_ARGUMENT}.name`] = JSON.stringify(params.name);
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
exports.extractTargetInfo = extractTargetInfo;
|
||||
exports.getRequestArguments = getRequestArguments;
|
||||
//# sourceMappingURL=methodConfig.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/methodConfig.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/methodConfig.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
77
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/piiFiltering.js
generated
vendored
Executable file
77
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/piiFiltering.js
generated
vendored
Executable file
@@ -0,0 +1,77 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const attributes = require('./attributes.js');
|
||||
|
||||
/**
|
||||
* PII attributes that should be removed when sendDefaultPii is false
|
||||
* @internal
|
||||
*/
|
||||
const PII_ATTRIBUTES = new Set([
|
||||
attributes.CLIENT_ADDRESS_ATTRIBUTE,
|
||||
attributes.CLIENT_PORT_ATTRIBUTE,
|
||||
attributes.MCP_LOGGING_MESSAGE_ATTRIBUTE,
|
||||
attributes.MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE,
|
||||
attributes.MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE,
|
||||
attributes.MCP_RESOURCE_URI_ATTRIBUTE,
|
||||
attributes.MCP_TOOL_RESULT_CONTENT_ATTRIBUTE,
|
||||
]);
|
||||
|
||||
/**
|
||||
* Checks if an attribute key should be considered PII.
|
||||
*
|
||||
* Returns true for:
|
||||
* - Explicit PII attributes (client.address, client.port, mcp.logging.message, etc.)
|
||||
* - All request arguments (mcp.request.argument.*)
|
||||
* - Tool and prompt result content (mcp.tool.result.*, mcp.prompt.result.*) except metadata
|
||||
*
|
||||
* Preserves metadata attributes ending with _count, _error, or .is_error as they don't contain sensitive data.
|
||||
*
|
||||
* @param key - Attribute key to evaluate
|
||||
* @returns true if the attribute should be filtered out (is PII), false if it should be preserved
|
||||
* @internal
|
||||
*/
|
||||
function isPiiAttribute(key) {
|
||||
if (PII_ATTRIBUTES.has(key)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key.startsWith(`${attributes.MCP_REQUEST_ARGUMENT}.`)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key.startsWith(`${attributes.MCP_TOOL_RESULT_PREFIX}.`) || key.startsWith(`${attributes.MCP_PROMPT_RESULT_PREFIX}.`)) {
|
||||
if (!key.endsWith('_count') && !key.endsWith('_error') && !key.endsWith('.is_error')) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes PII attributes from span data when sendDefaultPii is false
|
||||
* @param spanData - Raw span attributes
|
||||
* @param sendDefaultPii - Whether to include PII data
|
||||
* @returns Filtered span attributes
|
||||
*/
|
||||
function filterMcpPiiFromSpanData(
|
||||
spanData,
|
||||
sendDefaultPii,
|
||||
) {
|
||||
if (sendDefaultPii) {
|
||||
return spanData ;
|
||||
}
|
||||
|
||||
return Object.entries(spanData).reduce(
|
||||
(acc, [key, value]) => {
|
||||
if (!isPiiAttribute(key)) {
|
||||
acc[key] = value ;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{} ,
|
||||
);
|
||||
}
|
||||
|
||||
exports.filterMcpPiiFromSpanData = filterMcpPiiFromSpanData;
|
||||
//# sourceMappingURL=piiFiltering.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/piiFiltering.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/piiFiltering.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"piiFiltering.js","sources":["../../../../src/integrations/mcp-server/piiFiltering.ts"],"sourcesContent":["/**\n * PII filtering for MCP server spans\n *\n * Removes sensitive data when sendDefaultPii is false.\n * Uses configurable attribute filtering to protect user privacy.\n */\nimport type { SpanAttributeValue } from '../../types-hoist/span';\nimport {\n CLIENT_ADDRESS_ATTRIBUTE,\n CLIENT_PORT_ATTRIBUTE,\n MCP_LOGGING_MESSAGE_ATTRIBUTE,\n MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE,\n MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE,\n MCP_PROMPT_RESULT_PREFIX,\n MCP_REQUEST_ARGUMENT,\n MCP_RESOURCE_URI_ATTRIBUTE,\n MCP_TOOL_RESULT_CONTENT_ATTRIBUTE,\n MCP_TOOL_RESULT_PREFIX,\n} from './attributes';\n\n/**\n * PII attributes that should be removed when sendDefaultPii is false\n * @internal\n */\nconst PII_ATTRIBUTES = new Set([\n CLIENT_ADDRESS_ATTRIBUTE,\n CLIENT_PORT_ATTRIBUTE,\n MCP_LOGGING_MESSAGE_ATTRIBUTE,\n MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE,\n MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE,\n MCP_RESOURCE_URI_ATTRIBUTE,\n MCP_TOOL_RESULT_CONTENT_ATTRIBUTE,\n]);\n\n/**\n * Checks if an attribute key should be considered PII.\n *\n * Returns true for:\n * - Explicit PII attributes (client.address, client.port, mcp.logging.message, etc.)\n * - All request arguments (mcp.request.argument.*)\n * - Tool and prompt result content (mcp.tool.result.*, mcp.prompt.result.*) except metadata\n *\n * Preserves metadata attributes ending with _count, _error, or .is_error as they don't contain sensitive data.\n *\n * @param key - Attribute key to evaluate\n * @returns true if the attribute should be filtered out (is PII), false if it should be preserved\n * @internal\n */\nfunction isPiiAttribute(key: string): boolean {\n if (PII_ATTRIBUTES.has(key)) {\n return true;\n }\n\n if (key.startsWith(`${MCP_REQUEST_ARGUMENT}.`)) {\n return true;\n }\n\n if (key.startsWith(`${MCP_TOOL_RESULT_PREFIX}.`) || key.startsWith(`${MCP_PROMPT_RESULT_PREFIX}.`)) {\n if (!key.endsWith('_count') && !key.endsWith('_error') && !key.endsWith('.is_error')) {\n return true;\n }\n }\n\n return false;\n}\n\n/**\n * Removes PII attributes from span data when sendDefaultPii is false\n * @param spanData - Raw span attributes\n * @param sendDefaultPii - Whether to include PII data\n * @returns Filtered span attributes\n */\nexport function filterMcpPiiFromSpanData(\n spanData: Record<string, unknown>,\n sendDefaultPii: boolean,\n): Record<string, SpanAttributeValue> {\n if (sendDefaultPii) {\n return spanData as Record<string, SpanAttributeValue>;\n }\n\n return Object.entries(spanData).reduce(\n (acc, [key, value]) => {\n if (!isPiiAttribute(key)) {\n acc[key] = value as SpanAttributeValue;\n }\n return acc;\n },\n {} as Record<string, SpanAttributeValue>,\n );\n}\n"],"names":["CLIENT_ADDRESS_ATTRIBUTE","CLIENT_PORT_ATTRIBUTE","MCP_LOGGING_MESSAGE_ATTRIBUTE","MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE","MCP_PROMPT_RESULT_MESSAGE_CONTENT_ATTRIBUTE","MCP_RESOURCE_URI_ATTRIBUTE","MCP_TOOL_RESULT_CONTENT_ATTRIBUTE","MCP_REQUEST_ARGUMENT","MCP_TOOL_RESULT_PREFIX","MCP_PROMPT_RESULT_PREFIX"],"mappings":";;;;AAoBA;AACA;AACA;AACA;AACA,MAAM,cAAA,GAAiB,IAAI,GAAG,CAAC;AAC/B,EAAEA,mCAAwB;AAC1B,EAAEC,gCAAqB;AACvB,EAAEC,wCAA6B;AAC/B,EAAEC,kDAAuC;AACzC,EAAEC,sDAA2C;AAC7C,EAAEC,qCAA0B;AAC5B,EAAEC,4CAAiC;AACnC,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,CAAC,GAAG,EAAmB;AAC9C,EAAE,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;AAC/B,IAAI,OAAO,IAAI;AACf;;AAEA,EAAE,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,EAAAC,+BAAA,CAAA,CAAA,CAAA,CAAA,EAAA;AACA,IAAA,OAAA,IAAA;AACA;;AAEA,EAAA,IAAA,GAAA,CAAA,UAAA,CAAA,CAAA,EAAAC,iCAAA,CAAA,CAAA,CAAA,CAAA,IAAA,GAAA,CAAA,UAAA,CAAA,CAAA,EAAAC,mCAAA,CAAA,CAAA,CAAA,CAAA,EAAA;AACA,IAAA,IAAA,CAAA,GAAA,CAAA,QAAA,CAAA,QAAA,CAAA,IAAA,CAAA,GAAA,CAAA,QAAA,CAAA,QAAA,CAAA,IAAA,CAAA,GAAA,CAAA,QAAA,CAAA,WAAA,CAAA,EAAA;AACA,MAAA,OAAA,IAAA;AACA;AACA;;AAEA,EAAA,OAAA,KAAA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAA,wBAAA;AACA,EAAA,QAAA;AACA,EAAA,cAAA;AACA,EAAA;AACA,EAAA,IAAA,cAAA,EAAA;AACA,IAAA,OAAA,QAAA;AACA;;AAEA,EAAA,OAAA,MAAA,CAAA,OAAA,CAAA,QAAA,CAAA,CAAA,MAAA;AACA,IAAA,CAAA,GAAA,EAAA,CAAA,GAAA,EAAA,KAAA,CAAA,KAAA;AACA,MAAA,IAAA,CAAA,cAAA,CAAA,GAAA,CAAA,EAAA;AACA,QAAA,GAAA,CAAA,GAAA,CAAA,GAAA,KAAA;AACA;AACA,MAAA,OAAA,GAAA;AACA,KAAA;AACA,IAAA,EAAA;AACA,GAAA;AACA;;;;"}
|
||||
128
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/resultExtraction.js
generated
vendored
Executable file
128
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/resultExtraction.js
generated
vendored
Executable file
@@ -0,0 +1,128 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const attributes = require('./attributes.js');
|
||||
const validation = require('./validation.js');
|
||||
|
||||
/**
|
||||
* Result extraction functions for MCP server instrumentation
|
||||
*
|
||||
* Handles extraction of attributes from tool and prompt execution results.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Build attributes for tool result content items
|
||||
* @param content - Array of content items from tool result
|
||||
* @returns Attributes extracted from each content item including type, text, mime type, URI, and resource info
|
||||
*/
|
||||
function buildAllContentItemAttributes(content) {
|
||||
const attributes$1 = {
|
||||
[attributes.MCP_TOOL_RESULT_CONTENT_COUNT_ATTRIBUTE]: content.length,
|
||||
};
|
||||
|
||||
for (const [i, item] of content.entries()) {
|
||||
if (!validation.isValidContentItem(item)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const prefix = content.length === 1 ? 'mcp.tool.result' : `mcp.tool.result.${i}`;
|
||||
|
||||
const safeSet = (key, value) => {
|
||||
if (typeof value === 'string') {
|
||||
attributes$1[`${prefix}.${key}`] = value;
|
||||
}
|
||||
};
|
||||
|
||||
safeSet('content_type', item.type);
|
||||
safeSet('mime_type', item.mimeType);
|
||||
safeSet('uri', item.uri);
|
||||
safeSet('name', item.name);
|
||||
|
||||
if (typeof item.text === 'string') {
|
||||
attributes$1[`${prefix}.content`] = item.text;
|
||||
}
|
||||
|
||||
if (typeof item.data === 'string') {
|
||||
attributes$1[`${prefix}.data_size`] = item.data.length;
|
||||
}
|
||||
|
||||
const resource = item.resource;
|
||||
if (validation.isValidContentItem(resource)) {
|
||||
safeSet('resource_uri', resource.uri);
|
||||
safeSet('resource_mime_type', resource.mimeType);
|
||||
}
|
||||
}
|
||||
|
||||
return attributes$1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract tool result attributes for span instrumentation
|
||||
* @param result - Tool execution result
|
||||
* @returns Attributes extracted from tool result content
|
||||
*/
|
||||
function extractToolResultAttributes(result) {
|
||||
if (!validation.isValidContentItem(result)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const attributes$1 = Array.isArray(result.content) ? buildAllContentItemAttributes(result.content) : {};
|
||||
|
||||
if (typeof result.isError === 'boolean') {
|
||||
attributes$1[attributes.MCP_TOOL_RESULT_IS_ERROR_ATTRIBUTE] = result.isError;
|
||||
}
|
||||
|
||||
return attributes$1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract prompt result attributes for span instrumentation
|
||||
* @param result - Prompt execution result
|
||||
* @returns Attributes extracted from prompt result
|
||||
*/
|
||||
function extractPromptResultAttributes(result) {
|
||||
const attributes$1 = {};
|
||||
if (!validation.isValidContentItem(result)) {
|
||||
return attributes$1;
|
||||
}
|
||||
|
||||
if (typeof result.description === 'string') {
|
||||
attributes$1[attributes.MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE] = result.description;
|
||||
}
|
||||
|
||||
if (Array.isArray(result.messages)) {
|
||||
attributes$1[attributes.MCP_PROMPT_RESULT_MESSAGE_COUNT_ATTRIBUTE] = result.messages.length;
|
||||
|
||||
const messages = result.messages;
|
||||
for (const [i, message] of messages.entries()) {
|
||||
if (!validation.isValidContentItem(message)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const prefix = messages.length === 1 ? 'mcp.prompt.result' : `mcp.prompt.result.${i}`;
|
||||
|
||||
const safeSet = (key, value) => {
|
||||
if (typeof value === 'string') {
|
||||
const attrName = messages.length === 1 ? `${prefix}.message_${key}` : `${prefix}.${key}`;
|
||||
attributes$1[attrName] = value;
|
||||
}
|
||||
};
|
||||
|
||||
safeSet('role', message.role);
|
||||
|
||||
if (validation.isValidContentItem(message.content)) {
|
||||
const content = message.content;
|
||||
if (typeof content.text === 'string') {
|
||||
const attrName = messages.length === 1 ? `${prefix}.message_content` : `${prefix}.content`;
|
||||
attributes$1[attrName] = content.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return attributes$1;
|
||||
}
|
||||
|
||||
exports.extractPromptResultAttributes = extractPromptResultAttributes;
|
||||
exports.extractToolResultAttributes = extractToolResultAttributes;
|
||||
//# sourceMappingURL=resultExtraction.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/resultExtraction.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/resultExtraction.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
197
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/sessionExtraction.js
generated
vendored
Executable file
197
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/sessionExtraction.js
generated
vendored
Executable file
@@ -0,0 +1,197 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const attributes = require('./attributes.js');
|
||||
const sessionManagement = require('./sessionManagement.js');
|
||||
const validation = require('./validation.js');
|
||||
|
||||
/**
|
||||
* Session and party info extraction functions for MCP server instrumentation
|
||||
*
|
||||
* Handles extraction of client/server info and session data from MCP messages.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Extracts and validates PartyInfo from an unknown object
|
||||
* @param obj - Unknown object that might contain party info
|
||||
* @returns Validated PartyInfo object with only string properties
|
||||
*/
|
||||
function extractPartyInfo(obj) {
|
||||
const partyInfo = {};
|
||||
|
||||
if (validation.isValidContentItem(obj)) {
|
||||
if (typeof obj.name === 'string') {
|
||||
partyInfo.name = obj.name;
|
||||
}
|
||||
if (typeof obj.title === 'string') {
|
||||
partyInfo.title = obj.title;
|
||||
}
|
||||
if (typeof obj.version === 'string') {
|
||||
partyInfo.version = obj.version;
|
||||
}
|
||||
}
|
||||
|
||||
return partyInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts session data from "initialize" requests
|
||||
* @param request - JSON-RPC "initialize" request containing client info and protocol version
|
||||
* @returns Session data extracted from request parameters including protocol version and client info
|
||||
*/
|
||||
function extractSessionDataFromInitializeRequest(request) {
|
||||
const sessionData = {};
|
||||
if (validation.isValidContentItem(request.params)) {
|
||||
if (typeof request.params.protocolVersion === 'string') {
|
||||
sessionData.protocolVersion = request.params.protocolVersion;
|
||||
}
|
||||
if (request.params.clientInfo) {
|
||||
sessionData.clientInfo = extractPartyInfo(request.params.clientInfo);
|
||||
}
|
||||
}
|
||||
return sessionData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts session data from "initialize" response
|
||||
* @param result - "initialize" response result containing server info and protocol version
|
||||
* @returns Partial session data extracted from response including protocol version and server info
|
||||
*/
|
||||
function extractSessionDataFromInitializeResponse(result) {
|
||||
const sessionData = {};
|
||||
if (validation.isValidContentItem(result)) {
|
||||
if (typeof result.protocolVersion === 'string') {
|
||||
sessionData.protocolVersion = result.protocolVersion;
|
||||
}
|
||||
if (result.serverInfo) {
|
||||
sessionData.serverInfo = extractPartyInfo(result.serverInfo);
|
||||
}
|
||||
}
|
||||
return sessionData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build client attributes from stored client info
|
||||
* @param transport - MCP transport instance
|
||||
* @returns Client attributes for span instrumentation
|
||||
*/
|
||||
function getClientAttributes(transport) {
|
||||
const clientInfo = sessionManagement.getClientInfoForTransport(transport);
|
||||
const attributes = {};
|
||||
|
||||
if (clientInfo?.name) {
|
||||
attributes['mcp.client.name'] = clientInfo.name;
|
||||
}
|
||||
if (clientInfo?.title) {
|
||||
attributes['mcp.client.title'] = clientInfo.title;
|
||||
}
|
||||
if (clientInfo?.version) {
|
||||
attributes['mcp.client.version'] = clientInfo.version;
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build server attributes from stored server info
|
||||
* @param transport - MCP transport instance
|
||||
* @returns Server attributes for span instrumentation
|
||||
*/
|
||||
function getServerAttributes(transport) {
|
||||
const serverInfo = sessionManagement.getSessionDataForTransport(transport)?.serverInfo;
|
||||
const attributes$1 = {};
|
||||
|
||||
if (serverInfo?.name) {
|
||||
attributes$1[attributes.MCP_SERVER_NAME_ATTRIBUTE] = serverInfo.name;
|
||||
}
|
||||
if (serverInfo?.title) {
|
||||
attributes$1[attributes.MCP_SERVER_TITLE_ATTRIBUTE] = serverInfo.title;
|
||||
}
|
||||
if (serverInfo?.version) {
|
||||
attributes$1[attributes.MCP_SERVER_VERSION_ATTRIBUTE] = serverInfo.version;
|
||||
}
|
||||
|
||||
return attributes$1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts client connection info from extra handler data
|
||||
* @param extra - Extra handler data containing connection info
|
||||
* @returns Client address and port information
|
||||
*/
|
||||
function extractClientInfo(extra)
|
||||
|
||||
{
|
||||
return {
|
||||
address:
|
||||
extra?.requestInfo?.remoteAddress ||
|
||||
extra?.clientAddress ||
|
||||
extra?.request?.ip ||
|
||||
extra?.request?.connection?.remoteAddress,
|
||||
port: extra?.requestInfo?.remotePort || extra?.clientPort || extra?.request?.connection?.remotePort,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts transport types based on transport constructor name
|
||||
* @param transport - MCP transport instance
|
||||
* @returns Transport type mapping for span attributes
|
||||
*/
|
||||
function getTransportTypes(transport) {
|
||||
const transportName = transport.constructor?.name?.toLowerCase() || '';
|
||||
|
||||
if (transportName.includes('stdio')) {
|
||||
return { mcpTransport: 'stdio', networkTransport: 'pipe' };
|
||||
}
|
||||
|
||||
if (transportName.includes('streamablehttp') || transportName.includes('streamable')) {
|
||||
return { mcpTransport: 'http', networkTransport: 'tcp' };
|
||||
}
|
||||
|
||||
if (transportName.includes('sse')) {
|
||||
return { mcpTransport: 'sse', networkTransport: 'tcp' };
|
||||
}
|
||||
|
||||
return { mcpTransport: 'unknown', networkTransport: 'unknown' };
|
||||
}
|
||||
|
||||
/**
|
||||
* Build transport and network attributes
|
||||
* @param transport - MCP transport instance
|
||||
* @param extra - Optional extra handler data
|
||||
* @returns Transport attributes for span instrumentation
|
||||
*/
|
||||
function buildTransportAttributes(
|
||||
transport,
|
||||
extra,
|
||||
) {
|
||||
const sessionId = transport.sessionId;
|
||||
const clientInfo = extra ? extractClientInfo(extra) : {};
|
||||
const { mcpTransport, networkTransport } = getTransportTypes(transport);
|
||||
const clientAttributes = getClientAttributes(transport);
|
||||
const serverAttributes = getServerAttributes(transport);
|
||||
const protocolVersion = sessionManagement.getProtocolVersionForTransport(transport);
|
||||
|
||||
const attributes$1 = {
|
||||
...(sessionId && { [attributes.MCP_SESSION_ID_ATTRIBUTE]: sessionId }),
|
||||
...(clientInfo.address && { [attributes.CLIENT_ADDRESS_ATTRIBUTE]: clientInfo.address }),
|
||||
...(clientInfo.port && { [attributes.CLIENT_PORT_ATTRIBUTE]: clientInfo.port }),
|
||||
[attributes.MCP_TRANSPORT_ATTRIBUTE]: mcpTransport,
|
||||
[attributes.NETWORK_TRANSPORT_ATTRIBUTE]: networkTransport,
|
||||
[attributes.NETWORK_PROTOCOL_VERSION_ATTRIBUTE]: '2.0',
|
||||
...(protocolVersion && { [attributes.MCP_PROTOCOL_VERSION_ATTRIBUTE]: protocolVersion }),
|
||||
...clientAttributes,
|
||||
...serverAttributes,
|
||||
};
|
||||
|
||||
return attributes$1;
|
||||
}
|
||||
|
||||
exports.buildTransportAttributes = buildTransportAttributes;
|
||||
exports.extractClientInfo = extractClientInfo;
|
||||
exports.extractSessionDataFromInitializeRequest = extractSessionDataFromInitializeRequest;
|
||||
exports.extractSessionDataFromInitializeResponse = extractSessionDataFromInitializeResponse;
|
||||
exports.getClientAttributes = getClientAttributes;
|
||||
exports.getServerAttributes = getServerAttributes;
|
||||
exports.getTransportTypes = getTransportTypes;
|
||||
//# sourceMappingURL=sessionExtraction.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/sessionExtraction.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/sessionExtraction.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
73
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/sessionManagement.js
generated
vendored
Executable file
73
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/sessionManagement.js
generated
vendored
Executable file
@@ -0,0 +1,73 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
/**
|
||||
* Transport-scoped session data storage (only for transports with sessionId)
|
||||
* @internal Maps transport instances to session-level data
|
||||
*/
|
||||
const transportToSessionData = new WeakMap();
|
||||
|
||||
/**
|
||||
* Stores session data for a transport with sessionId
|
||||
* @param transport - MCP transport instance
|
||||
* @param sessionData - Session data to store
|
||||
*/
|
||||
function storeSessionDataForTransport(transport, sessionData) {
|
||||
if (transport.sessionId) {
|
||||
transportToSessionData.set(transport, sessionData);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates session data for a transport with sessionId (merges with existing data)
|
||||
* @param transport - MCP transport instance
|
||||
* @param partialSessionData - Partial session data to merge with existing data
|
||||
*/
|
||||
function updateSessionDataForTransport(transport, partialSessionData) {
|
||||
if (transport.sessionId) {
|
||||
const existingData = transportToSessionData.get(transport) || {};
|
||||
transportToSessionData.set(transport, { ...existingData, ...partialSessionData });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves client information for a transport
|
||||
* @param transport - MCP transport instance
|
||||
* @returns Client information if available
|
||||
*/
|
||||
function getClientInfoForTransport(transport) {
|
||||
return transportToSessionData.get(transport)?.clientInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves protocol version for a transport
|
||||
* @param transport - MCP transport instance
|
||||
* @returns Protocol version if available
|
||||
*/
|
||||
function getProtocolVersionForTransport(transport) {
|
||||
return transportToSessionData.get(transport)?.protocolVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves full session data for a transport
|
||||
* @param transport - MCP transport instance
|
||||
* @returns Complete session data if available
|
||||
*/
|
||||
function getSessionDataForTransport(transport) {
|
||||
return transportToSessionData.get(transport);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans up session data for a specific transport (when that transport closes)
|
||||
* @param transport - MCP transport instance
|
||||
*/
|
||||
function cleanupSessionDataForTransport(transport) {
|
||||
transportToSessionData.delete(transport);
|
||||
}
|
||||
|
||||
exports.cleanupSessionDataForTransport = cleanupSessionDataForTransport;
|
||||
exports.getClientInfoForTransport = getClientInfoForTransport;
|
||||
exports.getProtocolVersionForTransport = getProtocolVersionForTransport;
|
||||
exports.getSessionDataForTransport = getSessionDataForTransport;
|
||||
exports.storeSessionDataForTransport = storeSessionDataForTransport;
|
||||
exports.updateSessionDataForTransport = updateSessionDataForTransport;
|
||||
//# sourceMappingURL=sessionManagement.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/sessionManagement.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/sessionManagement.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"sessionManagement.js","sources":["../../../../src/integrations/mcp-server/sessionManagement.ts"],"sourcesContent":["/**\n * Session data management for MCP server instrumentation\n */\n\nimport type { MCPTransport, PartyInfo, SessionData } from './types';\n\n/**\n * Transport-scoped session data storage (only for transports with sessionId)\n * @internal Maps transport instances to session-level data\n */\nconst transportToSessionData = new WeakMap<MCPTransport, SessionData>();\n\n/**\n * Stores session data for a transport with sessionId\n * @param transport - MCP transport instance\n * @param sessionData - Session data to store\n */\nexport function storeSessionDataForTransport(transport: MCPTransport, sessionData: SessionData): void {\n if (transport.sessionId) {\n transportToSessionData.set(transport, sessionData);\n }\n}\n\n/**\n * Updates session data for a transport with sessionId (merges with existing data)\n * @param transport - MCP transport instance\n * @param partialSessionData - Partial session data to merge with existing data\n */\nexport function updateSessionDataForTransport(transport: MCPTransport, partialSessionData: Partial<SessionData>): void {\n if (transport.sessionId) {\n const existingData = transportToSessionData.get(transport) || {};\n transportToSessionData.set(transport, { ...existingData, ...partialSessionData });\n }\n}\n\n/**\n * Retrieves client information for a transport\n * @param transport - MCP transport instance\n * @returns Client information if available\n */\nexport function getClientInfoForTransport(transport: MCPTransport): PartyInfo | undefined {\n return transportToSessionData.get(transport)?.clientInfo;\n}\n\n/**\n * Retrieves protocol version for a transport\n * @param transport - MCP transport instance\n * @returns Protocol version if available\n */\nexport function getProtocolVersionForTransport(transport: MCPTransport): string | undefined {\n return transportToSessionData.get(transport)?.protocolVersion;\n}\n\n/**\n * Retrieves full session data for a transport\n * @param transport - MCP transport instance\n * @returns Complete session data if available\n */\nexport function getSessionDataForTransport(transport: MCPTransport): SessionData | undefined {\n return transportToSessionData.get(transport);\n}\n\n/**\n * Cleans up session data for a specific transport (when that transport closes)\n * @param transport - MCP transport instance\n */\nexport function cleanupSessionDataForTransport(transport: MCPTransport): void {\n transportToSessionData.delete(transport);\n}\n"],"names":[],"mappings":";;AAMA;AACA;AACA;AACA;AACA,MAAM,sBAAA,GAAyB,IAAI,OAAO,EAA6B;;AAEvE;AACA;AACA;AACA;AACA;AACO,SAAS,4BAA4B,CAAC,SAAS,EAAgB,WAAW,EAAqB;AACtG,EAAE,IAAI,SAAS,CAAC,SAAS,EAAE;AAC3B,IAAI,sBAAsB,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,CAAC;AACtD;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,6BAA6B,CAAC,SAAS,EAAgB,kBAAkB,EAA8B;AACvH,EAAE,IAAI,SAAS,CAAC,SAAS,EAAE;AAC3B,IAAI,MAAM,YAAA,GAAe,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAA,IAAK,EAAE;AACpE,IAAI,sBAAsB,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,kBAAA,EAAoB,CAAC;AACrF;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,SAAS,EAAuC;AAC1F,EAAE,OAAO,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,UAAU;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAC,SAAS,EAAoC;AAC5F,EAAE,OAAO,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,eAAe;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,SAAS,EAAyC;AAC7F,EAAE,OAAO,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC;AAC9C;;AAEA;AACA;AACA;AACA;AACO,SAAS,8BAA8B,CAAC,SAAS,EAAsB;AAC9E,EAAE,sBAAsB,CAAC,MAAM,CAAC,SAAS,CAAC;AAC1C;;;;;;;;;"}
|
||||
190
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/spans.js
generated
vendored
Executable file
190
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/spans.js
generated
vendored
Executable file
@@ -0,0 +1,190 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('../../currentScopes.js');
|
||||
const semanticAttributes = require('../../semanticAttributes.js');
|
||||
const trace = require('../../tracing/trace.js');
|
||||
const attributeExtraction = require('./attributeExtraction.js');
|
||||
const attributes = require('./attributes.js');
|
||||
const methodConfig = require('./methodConfig.js');
|
||||
const piiFiltering = require('./piiFiltering.js');
|
||||
const sessionExtraction = require('./sessionExtraction.js');
|
||||
|
||||
/**
|
||||
* Span creation and management functions for MCP server instrumentation
|
||||
*
|
||||
* Provides unified span creation following OpenTelemetry MCP semantic conventions and our opinitionated take on MCP.
|
||||
* Handles both request and notification spans with attribute extraction.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Creates a span name based on the method and target
|
||||
* @internal
|
||||
* @param method - MCP method name
|
||||
* @param target - Optional target identifier
|
||||
* @returns Formatted span name
|
||||
*/
|
||||
function createSpanName(method, target) {
|
||||
return target ? `${method} ${target}` : method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build Sentry-specific attributes based on span type
|
||||
* @internal
|
||||
* @param type - Span type configuration
|
||||
* @returns Sentry-specific attributes
|
||||
*/
|
||||
function buildSentryAttributes(type) {
|
||||
let op;
|
||||
let origin;
|
||||
|
||||
switch (type) {
|
||||
case 'request':
|
||||
op = attributes.MCP_SERVER_OP_VALUE;
|
||||
origin = attributes.MCP_FUNCTION_ORIGIN_VALUE;
|
||||
break;
|
||||
case 'notification-incoming':
|
||||
op = attributes.MCP_NOTIFICATION_CLIENT_TO_SERVER_OP_VALUE;
|
||||
origin = attributes.MCP_NOTIFICATION_ORIGIN_VALUE;
|
||||
break;
|
||||
case 'notification-outgoing':
|
||||
op = attributes.MCP_NOTIFICATION_SERVER_TO_CLIENT_OP_VALUE;
|
||||
origin = attributes.MCP_NOTIFICATION_ORIGIN_VALUE;
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_OP]: op,
|
||||
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: origin,
|
||||
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: attributes.MCP_ROUTE_SOURCE_VALUE,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Unified builder for creating MCP spans
|
||||
* @internal
|
||||
* @param config - Span configuration
|
||||
* @returns Created span
|
||||
*/
|
||||
function createMcpSpan(config) {
|
||||
const { type, message, transport, extra, callback } = config;
|
||||
const { method } = message;
|
||||
const params = message.params ;
|
||||
|
||||
// Determine span name based on type and OTEL conventions
|
||||
let spanName;
|
||||
if (type === 'request') {
|
||||
const targetInfo = methodConfig.extractTargetInfo(method, params || {});
|
||||
spanName = createSpanName(method, targetInfo.target);
|
||||
} else {
|
||||
// For notifications, use method name directly per OpenTelemetry conventions
|
||||
spanName = method;
|
||||
}
|
||||
|
||||
const rawAttributes = {
|
||||
...sessionExtraction.buildTransportAttributes(transport, extra),
|
||||
[attributes.MCP_METHOD_NAME_ATTRIBUTE]: method,
|
||||
...attributeExtraction.buildTypeSpecificAttributes(type, message, params),
|
||||
...buildSentryAttributes(type),
|
||||
};
|
||||
|
||||
const client = currentScopes.getClient();
|
||||
const sendDefaultPii = Boolean(client?.getOptions().sendDefaultPii);
|
||||
const attributes$1 = piiFiltering.filterMcpPiiFromSpanData(rawAttributes, sendDefaultPii) ;
|
||||
|
||||
return trace.startSpan(
|
||||
{
|
||||
name: spanName,
|
||||
forceTransaction: true,
|
||||
attributes: attributes$1,
|
||||
},
|
||||
callback,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a span for incoming MCP notifications
|
||||
* @param jsonRpcMessage - Notification message
|
||||
* @param transport - MCP transport instance
|
||||
* @param extra - Extra handler data
|
||||
* @param callback - Span execution callback
|
||||
* @returns Span execution result
|
||||
*/
|
||||
function createMcpNotificationSpan(
|
||||
jsonRpcMessage,
|
||||
transport,
|
||||
extra,
|
||||
callback,
|
||||
) {
|
||||
return createMcpSpan({
|
||||
type: 'notification-incoming',
|
||||
message: jsonRpcMessage,
|
||||
transport,
|
||||
extra,
|
||||
callback,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a span for outgoing MCP notifications
|
||||
* @param jsonRpcMessage - Notification message
|
||||
* @param transport - MCP transport instance
|
||||
* @param callback - Span execution callback
|
||||
* @returns Span execution result
|
||||
*/
|
||||
function createMcpOutgoingNotificationSpan(
|
||||
jsonRpcMessage,
|
||||
transport,
|
||||
callback,
|
||||
) {
|
||||
return createMcpSpan({
|
||||
type: 'notification-outgoing',
|
||||
message: jsonRpcMessage,
|
||||
transport,
|
||||
callback,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds span configuration for MCP server requests
|
||||
* @param jsonRpcMessage - Request message
|
||||
* @param transport - MCP transport instance
|
||||
* @param extra - Optional extra handler data
|
||||
* @returns Span configuration object
|
||||
*/
|
||||
function buildMcpServerSpanConfig(
|
||||
jsonRpcMessage,
|
||||
transport,
|
||||
extra,
|
||||
)
|
||||
|
||||
{
|
||||
const { method } = jsonRpcMessage;
|
||||
const params = jsonRpcMessage.params ;
|
||||
|
||||
const targetInfo = methodConfig.extractTargetInfo(method, params || {});
|
||||
const spanName = createSpanName(method, targetInfo.target);
|
||||
|
||||
const rawAttributes = {
|
||||
...sessionExtraction.buildTransportAttributes(transport, extra),
|
||||
[attributes.MCP_METHOD_NAME_ATTRIBUTE]: method,
|
||||
...attributeExtraction.buildTypeSpecificAttributes('request', jsonRpcMessage, params),
|
||||
...buildSentryAttributes('request'),
|
||||
};
|
||||
|
||||
const client = currentScopes.getClient();
|
||||
const sendDefaultPii = Boolean(client?.getOptions().sendDefaultPii);
|
||||
const attributes$1 = piiFiltering.filterMcpPiiFromSpanData(rawAttributes, sendDefaultPii) ;
|
||||
|
||||
return {
|
||||
name: spanName,
|
||||
op: attributes.MCP_SERVER_OP_VALUE,
|
||||
forceTransaction: true,
|
||||
attributes: attributes$1,
|
||||
};
|
||||
}
|
||||
|
||||
exports.buildMcpServerSpanConfig = buildMcpServerSpanConfig;
|
||||
exports.createMcpNotificationSpan = createMcpNotificationSpan;
|
||||
exports.createMcpOutgoingNotificationSpan = createMcpOutgoingNotificationSpan;
|
||||
//# sourceMappingURL=spans.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/spans.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/spans.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
186
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/transport.js
generated
vendored
Executable file
186
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/transport.js
generated
vendored
Executable file
@@ -0,0 +1,186 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const currentScopes = require('../../currentScopes.js');
|
||||
const object = require('../../utils/object.js');
|
||||
const trace = require('../../tracing/trace.js');
|
||||
const correlation = require('./correlation.js');
|
||||
const errorCapture = require('./errorCapture.js');
|
||||
const sessionExtraction = require('./sessionExtraction.js');
|
||||
const sessionManagement = require('./sessionManagement.js');
|
||||
const spans = require('./spans.js');
|
||||
const validation = require('./validation.js');
|
||||
|
||||
/**
|
||||
* Transport layer instrumentation for MCP server
|
||||
*
|
||||
* Handles message interception and response correlation.
|
||||
* @see https://modelcontextprotocol.io/specification/2025-06-18/basic/transports
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Wraps transport.onmessage to create spans for incoming messages.
|
||||
* For "initialize" requests, extracts and stores client info and protocol version
|
||||
* in the session data for the transport.
|
||||
* @param transport - MCP transport instance to wrap
|
||||
*/
|
||||
function wrapTransportOnMessage(transport) {
|
||||
if (transport.onmessage) {
|
||||
object.fill(transport, 'onmessage', originalOnMessage => {
|
||||
return function ( message, extra) {
|
||||
if (validation.isJsonRpcRequest(message)) {
|
||||
if (message.method === 'initialize') {
|
||||
try {
|
||||
const sessionData = sessionExtraction.extractSessionDataFromInitializeRequest(message);
|
||||
sessionManagement.storeSessionDataForTransport(this, sessionData);
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
const isolationScope = currentScopes.getIsolationScope().clone();
|
||||
|
||||
return currentScopes.withIsolationScope(isolationScope, () => {
|
||||
const spanConfig = spans.buildMcpServerSpanConfig(message, this, extra );
|
||||
const span = trace.startInactiveSpan(spanConfig);
|
||||
|
||||
correlation.storeSpanForRequest(this, message.id, span, message.method);
|
||||
|
||||
return trace.withActiveSpan(span, () => {
|
||||
return (originalOnMessage ).call(this, message, extra);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (validation.isJsonRpcNotification(message)) {
|
||||
return spans.createMcpNotificationSpan(message, this, extra , () => {
|
||||
return (originalOnMessage ).call(this, message, extra);
|
||||
});
|
||||
}
|
||||
|
||||
return (originalOnMessage ).call(this, message, extra);
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps transport.send to handle outgoing messages and response correlation.
|
||||
* For "initialize" responses, extracts and stores protocol version and server info
|
||||
* in the session data for the transport.
|
||||
* @param transport - MCP transport instance to wrap
|
||||
*/
|
||||
function wrapTransportSend(transport) {
|
||||
if (transport.send) {
|
||||
object.fill(transport, 'send', originalSend => {
|
||||
return async function ( ...args) {
|
||||
const [message] = args;
|
||||
|
||||
if (validation.isJsonRpcNotification(message)) {
|
||||
return spans.createMcpOutgoingNotificationSpan(message, this, () => {
|
||||
return (originalSend ).call(this, ...args);
|
||||
});
|
||||
}
|
||||
|
||||
if (validation.isJsonRpcResponse(message)) {
|
||||
if (message.id !== null && message.id !== undefined) {
|
||||
if (message.error) {
|
||||
captureJsonRpcErrorResponse(message.error);
|
||||
}
|
||||
|
||||
if (validation.isValidContentItem(message.result)) {
|
||||
if (message.result.protocolVersion || message.result.serverInfo) {
|
||||
try {
|
||||
const serverData = sessionExtraction.extractSessionDataFromInitializeResponse(message.result);
|
||||
sessionManagement.updateSessionDataForTransport(this, serverData);
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
correlation.completeSpanWithResults(this, message.id, message.result);
|
||||
}
|
||||
}
|
||||
|
||||
return (originalSend ).call(this, ...args);
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps transport.onclose to clean up pending spans for this transport only
|
||||
* @param transport - MCP transport instance to wrap
|
||||
*/
|
||||
function wrapTransportOnClose(transport) {
|
||||
if (transport.onclose) {
|
||||
object.fill(transport, 'onclose', originalOnClose => {
|
||||
return function ( ...args) {
|
||||
correlation.cleanupPendingSpansForTransport(this);
|
||||
sessionManagement.cleanupSessionDataForTransport(this);
|
||||
return (originalOnClose ).call(this, ...args);
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps transport error handlers to capture connection errors
|
||||
* @param transport - MCP transport instance to wrap
|
||||
*/
|
||||
function wrapTransportError(transport) {
|
||||
if (transport.onerror) {
|
||||
object.fill(transport, 'onerror', (originalOnError) => {
|
||||
return function ( error) {
|
||||
captureTransportError(error);
|
||||
return originalOnError.call(this, error);
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures JSON-RPC error responses for server-side errors.
|
||||
* @see https://www.jsonrpc.org/specification#error_object
|
||||
* @internal
|
||||
* @param errorResponse - JSON-RPC error response
|
||||
*/
|
||||
function captureJsonRpcErrorResponse(errorResponse) {
|
||||
try {
|
||||
if (errorResponse && typeof errorResponse === 'object' && 'code' in errorResponse && 'message' in errorResponse) {
|
||||
const jsonRpcError = errorResponse ;
|
||||
|
||||
const isServerError =
|
||||
jsonRpcError.code === -32603 || (jsonRpcError.code >= -32099 && jsonRpcError.code <= -32000);
|
||||
|
||||
if (isServerError) {
|
||||
const error = new Error(jsonRpcError.message);
|
||||
error.name = `JsonRpcError_${jsonRpcError.code}`;
|
||||
|
||||
errorCapture.captureError(error, 'protocol');
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures transport connection errors
|
||||
* @internal
|
||||
* @param error - Transport error
|
||||
*/
|
||||
function captureTransportError(error) {
|
||||
try {
|
||||
errorCapture.captureError(error, 'transport');
|
||||
} catch {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
|
||||
exports.wrapTransportError = wrapTransportError;
|
||||
exports.wrapTransportOnClose = wrapTransportOnClose;
|
||||
exports.wrapTransportOnMessage = wrapTransportOnMessage;
|
||||
exports.wrapTransportSend = wrapTransportSend;
|
||||
//# sourceMappingURL=transport.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/transport.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/transport.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
95
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/validation.js
generated
vendored
Executable file
95
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/validation.js
generated
vendored
Executable file
@@ -0,0 +1,95 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const debugBuild = require('../../debug-build.js');
|
||||
const debugLogger = require('../../utils/debug-logger.js');
|
||||
|
||||
/**
|
||||
* Message validation functions for MCP server instrumentation
|
||||
*
|
||||
* Provides JSON-RPC 2.0 message type validation and MCP server instance validation.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Validates if a message is a JSON-RPC request
|
||||
* @param message - Message to validate
|
||||
* @returns True if message is a JSON-RPC request
|
||||
*/
|
||||
function isJsonRpcRequest(message) {
|
||||
return (
|
||||
typeof message === 'object' &&
|
||||
message !== null &&
|
||||
'jsonrpc' in message &&
|
||||
(message ).jsonrpc === '2.0' &&
|
||||
'method' in message &&
|
||||
'id' in message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if a message is a JSON-RPC notification
|
||||
* @param message - Message to validate
|
||||
* @returns True if message is a JSON-RPC notification
|
||||
*/
|
||||
function isJsonRpcNotification(message) {
|
||||
return (
|
||||
typeof message === 'object' &&
|
||||
message !== null &&
|
||||
'jsonrpc' in message &&
|
||||
(message ).jsonrpc === '2.0' &&
|
||||
'method' in message &&
|
||||
!('id' in message)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if a message is a JSON-RPC response
|
||||
* @param message - Message to validate
|
||||
* @returns True if message is a JSON-RPC response
|
||||
*/
|
||||
function isJsonRpcResponse(message) {
|
||||
return (
|
||||
typeof message === 'object' &&
|
||||
message !== null &&
|
||||
'jsonrpc' in message &&
|
||||
(message ).jsonrpc === '2.0' &&
|
||||
'id' in message &&
|
||||
('result' in message || 'error' in message)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates MCP server instance with type checking
|
||||
* @param instance - Object to validate as MCP server instance
|
||||
* @returns True if instance has required MCP server methods
|
||||
*/
|
||||
function validateMcpServerInstance(instance) {
|
||||
if (
|
||||
typeof instance === 'object' &&
|
||||
instance !== null &&
|
||||
'resource' in instance &&
|
||||
'tool' in instance &&
|
||||
'prompt' in instance &&
|
||||
'connect' in instance
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('Did not patch MCP server. Interface is incompatible.');
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the item is a valid content item
|
||||
* @param item - The item to check
|
||||
* @returns True if the item is a valid content item, false otherwise
|
||||
*/
|
||||
function isValidContentItem(item) {
|
||||
return item != null && typeof item === 'object';
|
||||
}
|
||||
|
||||
exports.isJsonRpcNotification = isJsonRpcNotification;
|
||||
exports.isJsonRpcRequest = isJsonRpcRequest;
|
||||
exports.isJsonRpcResponse = isJsonRpcResponse;
|
||||
exports.isValidContentItem = isValidContentItem;
|
||||
exports.validateMcpServerInstance = validateMcpServerInstance;
|
||||
//# sourceMappingURL=validation.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/validation.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/mcp-server/validation.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"validation.js","sources":["../../../../src/integrations/mcp-server/validation.ts"],"sourcesContent":["/**\n * Message validation functions for MCP server instrumentation\n *\n * Provides JSON-RPC 2.0 message type validation and MCP server instance validation.\n */\n\nimport { DEBUG_BUILD } from '../../debug-build';\nimport { debug } from '../../utils/debug-logger';\nimport type { JsonRpcNotification, JsonRpcRequest, JsonRpcResponse } from './types';\n\n/**\n * Validates if a message is a JSON-RPC request\n * @param message - Message to validate\n * @returns True if message is a JSON-RPC request\n */\nexport function isJsonRpcRequest(message: unknown): message is JsonRpcRequest {\n return (\n typeof message === 'object' &&\n message !== null &&\n 'jsonrpc' in message &&\n (message as JsonRpcRequest).jsonrpc === '2.0' &&\n 'method' in message &&\n 'id' in message\n );\n}\n\n/**\n * Validates if a message is a JSON-RPC notification\n * @param message - Message to validate\n * @returns True if message is a JSON-RPC notification\n */\nexport function isJsonRpcNotification(message: unknown): message is JsonRpcNotification {\n return (\n typeof message === 'object' &&\n message !== null &&\n 'jsonrpc' in message &&\n (message as JsonRpcNotification).jsonrpc === '2.0' &&\n 'method' in message &&\n !('id' in message)\n );\n}\n\n/**\n * Validates if a message is a JSON-RPC response\n * @param message - Message to validate\n * @returns True if message is a JSON-RPC response\n */\nexport function isJsonRpcResponse(message: unknown): message is JsonRpcResponse {\n return (\n typeof message === 'object' &&\n message !== null &&\n 'jsonrpc' in message &&\n (message as { jsonrpc: string }).jsonrpc === '2.0' &&\n 'id' in message &&\n ('result' in message || 'error' in message)\n );\n}\n\n/**\n * Validates MCP server instance with type checking\n * @param instance - Object to validate as MCP server instance\n * @returns True if instance has required MCP server methods\n */\nexport function validateMcpServerInstance(instance: unknown): boolean {\n if (\n typeof instance === 'object' &&\n instance !== null &&\n 'resource' in instance &&\n 'tool' in instance &&\n 'prompt' in instance &&\n 'connect' in instance\n ) {\n return true;\n }\n DEBUG_BUILD && debug.warn('Did not patch MCP server. Interface is incompatible.');\n return false;\n}\n\n/**\n * Check if the item is a valid content item\n * @param item - The item to check\n * @returns True if the item is a valid content item, false otherwise\n */\nexport function isValidContentItem(item: unknown): item is Record<string, unknown> {\n return item != null && typeof item === 'object';\n}\n"],"names":["DEBUG_BUILD","debug"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;;;AAMA;AACA;AACA;AACA;AACA;AACO,SAAS,gBAAgB,CAAC,OAAO,EAAsC;AAC9E,EAAE;AACF,IAAI,OAAO,OAAA,KAAY,QAAA;AACvB,IAAI,OAAA,KAAY,IAAA;AAChB,IAAI,SAAA,IAAa,OAAA;AACjB,IAAI,CAAC,OAAA,GAA2B,OAAA,KAAY,KAAA;AAC5C,IAAI,QAAA,IAAY,OAAA;AAChB,IAAI,QAAQ;AACZ;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,qBAAqB,CAAC,OAAO,EAA2C;AACxF,EAAE;AACF,IAAI,OAAO,OAAA,KAAY,QAAA;AACvB,IAAI,OAAA,KAAY,IAAA;AAChB,IAAI,SAAA,IAAa,OAAA;AACjB,IAAI,CAAC,OAAA,GAAgC,OAAA,KAAY,KAAA;AACjD,IAAI,QAAA,IAAY,OAAA;AAChB,IAAI,EAAE,IAAA,IAAQ,OAAO;AACrB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,OAAO,EAAuC;AAChF,EAAE;AACF,IAAI,OAAO,OAAA,KAAY,QAAA;AACvB,IAAI,OAAA,KAAY,IAAA;AAChB,IAAI,SAAA,IAAa,OAAA;AACjB,IAAI,CAAC,OAAA,GAAgC,OAAA,KAAY,KAAA;AACjD,IAAI,IAAA,IAAQ,OAAA;AACZ,KAAK,QAAA,IAAY,WAAW,OAAA,IAAW,OAAO;AAC9C;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,yBAAyB,CAAC,QAAQ,EAAoB;AACtE,EAAE;AACF,IAAI,OAAO,QAAA,KAAa,QAAA;AACxB,IAAI,QAAA,KAAa,IAAA;AACjB,IAAI,UAAA,IAAc,QAAA;AAClB,IAAI,MAAA,IAAU,QAAA;AACd,IAAI,QAAA,IAAY,QAAA;AAChB,IAAI,aAAa;AACjB,IAAI;AACJ,IAAI,OAAO,IAAI;AACf;AACA,EAAEA,0BAAeC,iBAAK,CAAC,IAAI,CAAC,sDAAsD,CAAC;AACnF,EAAE,OAAO,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,IAAI,EAA4C;AACnF,EAAE,OAAO,QAAQ,IAAA,IAAQ,OAAO,IAAA,KAAS,QAAQ;AACjD;;;;;;;;"}
|
||||
48
dev/env/node_modules/@sentry/core/build/cjs/integrations/metadata.js
generated
vendored
Executable file
48
dev/env/node_modules/@sentry/core/build/cjs/integrations/metadata.js
generated
vendored
Executable file
@@ -0,0 +1,48 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const integration = require('../integration.js');
|
||||
const metadata = require('../metadata.js');
|
||||
const envelope = require('../utils/envelope.js');
|
||||
|
||||
/**
|
||||
* Adds module metadata to stack frames.
|
||||
*
|
||||
* Metadata can be injected by the Sentry bundler plugins using the `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
|
||||
*/
|
||||
const moduleMetadataIntegration = integration.defineIntegration(() => {
|
||||
return {
|
||||
name: 'ModuleMetadata',
|
||||
setup(client) {
|
||||
// We need to strip metadata from stack frames before sending them to Sentry since these are client side only.
|
||||
client.on('beforeEnvelope', envelope$1 => {
|
||||
envelope.forEachEnvelopeItem(envelope$1, (item, type) => {
|
||||
if (type === 'event') {
|
||||
const event = Array.isArray(item) ? (item )[1] : undefined;
|
||||
|
||||
if (event) {
|
||||
metadata.stripMetadataFromStackFrames(event);
|
||||
item[1] = event;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
client.on('applyFrameMetadata', event => {
|
||||
// Only apply stack frame metadata to error events
|
||||
if (event.type) {
|
||||
return;
|
||||
}
|
||||
|
||||
const stackParser = client.getOptions().stackParser;
|
||||
metadata.addMetadataToStackFrames(stackParser, event);
|
||||
});
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
exports.moduleMetadataIntegration = moduleMetadataIntegration;
|
||||
//# sourceMappingURL=metadata.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/metadata.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/metadata.js.map
generated
vendored
Executable file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"metadata.js","sources":["../../../src/integrations/metadata.ts"],"sourcesContent":["import { defineIntegration } from '../integration';\nimport { addMetadataToStackFrames, stripMetadataFromStackFrames } from '../metadata';\nimport type { EventItem } from '../types-hoist/envelope';\nimport { forEachEnvelopeItem } from '../utils/envelope';\n\n/**\n * Adds module metadata to stack frames.\n *\n * Metadata can be injected by the Sentry bundler plugins using the `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 */\nexport const moduleMetadataIntegration = defineIntegration(() => {\n return {\n name: 'ModuleMetadata',\n setup(client) {\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 client.on('applyFrameMetadata', event => {\n // Only apply stack frame metadata to error events\n if (event.type) {\n return;\n }\n\n const stackParser = client.getOptions().stackParser;\n addMetadataToStackFrames(stackParser, event);\n });\n },\n };\n});\n"],"names":["defineIntegration","envelope","forEachEnvelopeItem","stripMetadataFromStackFrames","addMetadataToStackFrames"],"mappings":";;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MACa,yBAAA,GAA4BA,6BAAiB,CAAC,MAAM;AACjE,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB;AACA,MAAM,MAAM,CAAC,EAAE,CAAC,gBAAgB,EAAEC,cAAY;AAC9C,QAAQC,4BAAmB,CAACD,UAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK;AACtD,UAAU,IAAI,IAAA,KAAS,OAAO,EAAE;AAChC,YAAY,MAAM,KAAA,GAAQ,KAAK,CAAC,OAAO,CAAC,IAAI,CAAA,GAAI,CAAC,IAAA,GAAmB,CAAC,CAAA,GAAI,SAAS;;AAElF,YAAY,IAAI,KAAK,EAAE;AACvB,cAAcE,qCAA4B,CAAC,KAAK,CAAC;AACjD,cAAc,IAAI,CAAC,CAAC,CAAA,GAAI,KAAK;AAC7B;AACA;AACA,SAAS,CAAC;AACV,OAAO,CAAC;;AAER,MAAM,MAAM,CAAC,EAAE,CAAC,oBAAoB,EAAE,SAAS;AAC/C;AACA,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE;AACxB,UAAU;AACV;;AAEA,QAAQ,MAAM,cAAc,MAAM,CAAC,UAAU,EAAE,CAAC,WAAW;AAC3D,QAAQC,iCAAwB,CAAC,WAAW,EAAE,KAAK,CAAC;AACpD,OAAO,CAAC;AACR,KAAK;AACL,GAAG;AACH,CAAC;;;;"}
|
||||
124
dev/env/node_modules/@sentry/core/build/cjs/integrations/requestdata.js
generated
vendored
Executable file
124
dev/env/node_modules/@sentry/core/build/cjs/integrations/requestdata.js
generated
vendored
Executable file
@@ -0,0 +1,124 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const integration = require('../integration.js');
|
||||
const cookie = require('../utils/cookie.js');
|
||||
const getIpAddress = require('../vendor/getIpAddress.js');
|
||||
|
||||
// TODO(v10): Change defaults based on `sendDefaultPii`
|
||||
const DEFAULT_INCLUDE = {
|
||||
cookies: true,
|
||||
data: true,
|
||||
headers: true,
|
||||
query_string: true,
|
||||
url: true,
|
||||
};
|
||||
|
||||
const INTEGRATION_NAME = 'RequestData';
|
||||
|
||||
const _requestDataIntegration = ((options = {}) => {
|
||||
const include = {
|
||||
...DEFAULT_INCLUDE,
|
||||
...options.include,
|
||||
};
|
||||
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
processEvent(event, _hint, client) {
|
||||
const { sdkProcessingMetadata = {} } = event;
|
||||
const { normalizedRequest, ipAddress } = sdkProcessingMetadata;
|
||||
|
||||
const includeWithDefaultPiiApplied = {
|
||||
...include,
|
||||
ip: include.ip ?? client.getOptions().sendDefaultPii,
|
||||
};
|
||||
|
||||
if (normalizedRequest) {
|
||||
addNormalizedRequestDataToEvent(event, normalizedRequest, { ipAddress }, includeWithDefaultPiiApplied);
|
||||
}
|
||||
|
||||
return event;
|
||||
},
|
||||
};
|
||||
}) ;
|
||||
|
||||
/**
|
||||
* Add data about a request to an event. Primarily for use in Node-based SDKs, but included in `@sentry/core`
|
||||
* so it can be used in cross-platform SDKs like `@sentry/nextjs`.
|
||||
*/
|
||||
const requestDataIntegration = integration.defineIntegration(_requestDataIntegration);
|
||||
|
||||
/**
|
||||
* Add already normalized request data to an event.
|
||||
* This mutates the passed in event.
|
||||
*/
|
||||
function addNormalizedRequestDataToEvent(
|
||||
event,
|
||||
req,
|
||||
// Data that should not go into `event.request` but is somehow related to requests
|
||||
additionalData,
|
||||
include,
|
||||
) {
|
||||
event.request = {
|
||||
...event.request,
|
||||
...extractNormalizedRequestData(req, include),
|
||||
};
|
||||
|
||||
if (include.ip) {
|
||||
const ip = (req.headers && getIpAddress.getClientIPAddress(req.headers)) || additionalData.ipAddress;
|
||||
if (ip) {
|
||||
event.user = {
|
||||
...event.user,
|
||||
ip_address: ip,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function extractNormalizedRequestData(
|
||||
normalizedRequest,
|
||||
include,
|
||||
) {
|
||||
const requestData = {};
|
||||
const headers = { ...normalizedRequest.headers };
|
||||
|
||||
if (include.headers) {
|
||||
requestData.headers = headers;
|
||||
|
||||
// Remove the Cookie header in case cookie data should not be included in the event
|
||||
if (!include.cookies) {
|
||||
delete (headers ).cookie;
|
||||
}
|
||||
|
||||
// Remove IP headers in case IP data should not be included in the event
|
||||
if (!include.ip) {
|
||||
getIpAddress.ipHeaderNames.forEach(ipHeaderName => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
||||
delete (headers )[ipHeaderName];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
requestData.method = normalizedRequest.method;
|
||||
|
||||
if (include.url) {
|
||||
requestData.url = normalizedRequest.url;
|
||||
}
|
||||
|
||||
if (include.cookies) {
|
||||
const cookies = normalizedRequest.cookies || (headers?.cookie ? cookie.parseCookie(headers.cookie) : undefined);
|
||||
requestData.cookies = cookies || {};
|
||||
}
|
||||
|
||||
if (include.query_string) {
|
||||
requestData.query_string = normalizedRequest.query_string;
|
||||
}
|
||||
|
||||
if (include.data) {
|
||||
requestData.data = normalizedRequest.data;
|
||||
}
|
||||
|
||||
return requestData;
|
||||
}
|
||||
|
||||
exports.requestDataIntegration = requestDataIntegration;
|
||||
//# sourceMappingURL=requestdata.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/requestdata.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/requestdata.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
111
dev/env/node_modules/@sentry/core/build/cjs/integrations/rewriteframes.js
generated
vendored
Executable file
111
dev/env/node_modules/@sentry/core/build/cjs/integrations/rewriteframes.js
generated
vendored
Executable file
@@ -0,0 +1,111 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const integration = require('../integration.js');
|
||||
const path = require('../utils/path.js');
|
||||
const worldwide = require('../utils/worldwide.js');
|
||||
|
||||
const INTEGRATION_NAME = 'RewriteFrames';
|
||||
|
||||
/**
|
||||
* Rewrite event frames paths.
|
||||
*/
|
||||
const rewriteFramesIntegration = integration.defineIntegration((options = {}) => {
|
||||
const root = options.root;
|
||||
const prefix = options.prefix || 'app:///';
|
||||
|
||||
const isBrowser = 'window' in worldwide.GLOBAL_OBJ && !!worldwide.GLOBAL_OBJ.window;
|
||||
|
||||
const iteratee = options.iteratee || generateIteratee({ isBrowser, root, prefix });
|
||||
|
||||
/** Process an exception event. */
|
||||
function _processExceptionsEvent(event) {
|
||||
try {
|
||||
return {
|
||||
...event,
|
||||
exception: {
|
||||
...event.exception,
|
||||
// The check for this is performed inside `process` call itself, safe to skip here
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
values: event.exception.values.map(value => ({
|
||||
...value,
|
||||
...(value.stacktrace && { stacktrace: _processStacktrace(value.stacktrace) }),
|
||||
})),
|
||||
},
|
||||
};
|
||||
} catch {
|
||||
return event;
|
||||
}
|
||||
}
|
||||
|
||||
/** Process a stack trace. */
|
||||
function _processStacktrace(stacktrace) {
|
||||
return {
|
||||
...stacktrace,
|
||||
frames: stacktrace?.frames?.map(f => iteratee(f)),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
name: INTEGRATION_NAME,
|
||||
processEvent(originalEvent) {
|
||||
let processedEvent = originalEvent;
|
||||
|
||||
if (originalEvent.exception && Array.isArray(originalEvent.exception.values)) {
|
||||
processedEvent = _processExceptionsEvent(processedEvent);
|
||||
}
|
||||
|
||||
return processedEvent;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Exported only for tests.
|
||||
*/
|
||||
function generateIteratee({
|
||||
isBrowser,
|
||||
root,
|
||||
prefix,
|
||||
}
|
||||
|
||||
) {
|
||||
return (frame) => {
|
||||
if (!frame.filename) {
|
||||
return frame;
|
||||
}
|
||||
|
||||
// Determine if this is a Windows frame by checking for a Windows-style prefix such as `C:\`
|
||||
const isWindowsFrame =
|
||||
/^[a-zA-Z]:\\/.test(frame.filename) ||
|
||||
// or the presence of a backslash without a forward slash (which are not allowed on Windows)
|
||||
(frame.filename.includes('\\') && !frame.filename.includes('/'));
|
||||
|
||||
// Check if the frame filename begins with `/`
|
||||
const startsWithSlash = /^\//.test(frame.filename);
|
||||
|
||||
if (isBrowser) {
|
||||
if (root) {
|
||||
const oldFilename = frame.filename;
|
||||
if (oldFilename.indexOf(root) === 0) {
|
||||
frame.filename = oldFilename.replace(root, prefix);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isWindowsFrame || startsWithSlash) {
|
||||
const filename = isWindowsFrame
|
||||
? frame.filename
|
||||
.replace(/^[a-zA-Z]:/, '') // remove Windows-style prefix
|
||||
.replace(/\\/g, '/') // replace all `\\` instances with `/`
|
||||
: frame.filename;
|
||||
const base = root ? path.relative(root, filename) : path.basename(filename);
|
||||
frame.filename = `${prefix}${base}`;
|
||||
}
|
||||
}
|
||||
|
||||
return frame;
|
||||
};
|
||||
}
|
||||
|
||||
exports.generateIteratee = generateIteratee;
|
||||
exports.rewriteFramesIntegration = rewriteFramesIntegration;
|
||||
//# sourceMappingURL=rewriteframes.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/rewriteframes.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/rewriteframes.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
467
dev/env/node_modules/@sentry/core/build/cjs/integrations/supabase.js
generated
vendored
Executable file
467
dev/env/node_modules/@sentry/core/build/cjs/integrations/supabase.js
generated
vendored
Executable file
@@ -0,0 +1,467 @@
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||
|
||||
const breadcrumbs = require('../breadcrumbs.js');
|
||||
const debugBuild = require('../debug-build.js');
|
||||
const exports$1 = require('../exports.js');
|
||||
const integration = require('../integration.js');
|
||||
const semanticAttributes = require('../semanticAttributes.js');
|
||||
const debugLogger = require('../utils/debug-logger.js');
|
||||
const is = require('../utils/is.js');
|
||||
const spanstatus = require('../tracing/spanstatus.js');
|
||||
const trace = require('../tracing/trace.js');
|
||||
|
||||
// Based on Kamil Ogórek's work on:
|
||||
// https://github.com/supabase-community/sentry-integration-js
|
||||
|
||||
|
||||
const AUTH_OPERATIONS_TO_INSTRUMENT = [
|
||||
'reauthenticate',
|
||||
'signInAnonymously',
|
||||
'signInWithOAuth',
|
||||
'signInWithIdToken',
|
||||
'signInWithOtp',
|
||||
'signInWithPassword',
|
||||
'signInWithSSO',
|
||||
'signOut',
|
||||
'signUp',
|
||||
'verifyOtp',
|
||||
];
|
||||
|
||||
const AUTH_ADMIN_OPERATIONS_TO_INSTRUMENT = [
|
||||
'createUser',
|
||||
'deleteUser',
|
||||
'listUsers',
|
||||
'getUserById',
|
||||
'updateUserById',
|
||||
'inviteUserByEmail',
|
||||
];
|
||||
|
||||
const FILTER_MAPPINGS = {
|
||||
eq: 'eq',
|
||||
neq: 'neq',
|
||||
gt: 'gt',
|
||||
gte: 'gte',
|
||||
lt: 'lt',
|
||||
lte: 'lte',
|
||||
like: 'like',
|
||||
'like(all)': 'likeAllOf',
|
||||
'like(any)': 'likeAnyOf',
|
||||
ilike: 'ilike',
|
||||
'ilike(all)': 'ilikeAllOf',
|
||||
'ilike(any)': 'ilikeAnyOf',
|
||||
is: 'is',
|
||||
in: 'in',
|
||||
cs: 'contains',
|
||||
cd: 'containedBy',
|
||||
sr: 'rangeGt',
|
||||
nxl: 'rangeGte',
|
||||
sl: 'rangeLt',
|
||||
nxr: 'rangeLte',
|
||||
adj: 'rangeAdjacent',
|
||||
ov: 'overlaps',
|
||||
fts: '',
|
||||
plfts: 'plain',
|
||||
phfts: 'phrase',
|
||||
wfts: 'websearch',
|
||||
not: 'not',
|
||||
};
|
||||
|
||||
const DB_OPERATIONS_TO_INSTRUMENT = ['select', 'insert', 'upsert', 'update', 'delete'];
|
||||
|
||||
function markAsInstrumented(fn) {
|
||||
try {
|
||||
(fn ).__SENTRY_INSTRUMENTED__ = true;
|
||||
} catch {
|
||||
// ignore errors here
|
||||
}
|
||||
}
|
||||
|
||||
function isInstrumented(fn) {
|
||||
try {
|
||||
return (fn ).__SENTRY_INSTRUMENTED__;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts the database operation type from the HTTP method and headers
|
||||
* @param method - The HTTP method of the request
|
||||
* @param headers - The request headers
|
||||
* @returns The database operation type ('select', 'insert', 'upsert', 'update', or 'delete')
|
||||
*/
|
||||
function extractOperation(method, headers = {}) {
|
||||
switch (method) {
|
||||
case 'GET': {
|
||||
return 'select';
|
||||
}
|
||||
case 'POST': {
|
||||
if (headers['Prefer']?.includes('resolution=')) {
|
||||
return 'upsert';
|
||||
} else {
|
||||
return 'insert';
|
||||
}
|
||||
}
|
||||
case 'PATCH': {
|
||||
return 'update';
|
||||
}
|
||||
case 'DELETE': {
|
||||
return 'delete';
|
||||
}
|
||||
default: {
|
||||
return '<unknown-op>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates Supabase filter parameters into readable method names for tracing
|
||||
* @param key - The filter key from the URL search parameters
|
||||
* @param query - The filter value from the URL search parameters
|
||||
* @returns A string representation of the filter as a method call
|
||||
*/
|
||||
function translateFiltersIntoMethods(key, query) {
|
||||
if (query === '' || query === '*') {
|
||||
return 'select(*)';
|
||||
}
|
||||
|
||||
if (key === 'select') {
|
||||
return `select(${query})`;
|
||||
}
|
||||
|
||||
if (key === 'or' || key.endsWith('.or')) {
|
||||
return `${key}${query}`;
|
||||
}
|
||||
|
||||
const [filter, ...value] = query.split('.');
|
||||
|
||||
let method;
|
||||
// Handle optional `configPart` of the filter
|
||||
if (filter?.startsWith('fts')) {
|
||||
method = 'textSearch';
|
||||
} else if (filter?.startsWith('plfts')) {
|
||||
method = 'textSearch[plain]';
|
||||
} else if (filter?.startsWith('phfts')) {
|
||||
method = 'textSearch[phrase]';
|
||||
} else if (filter?.startsWith('wfts')) {
|
||||
method = 'textSearch[websearch]';
|
||||
} else {
|
||||
method = (filter && FILTER_MAPPINGS[filter ]) || 'filter';
|
||||
}
|
||||
|
||||
return `${method}(${key}, ${value.join('.')})`;
|
||||
}
|
||||
|
||||
function instrumentAuthOperation(operation, isAdmin = false) {
|
||||
return new Proxy(operation, {
|
||||
apply(target, thisArg, argumentsList) {
|
||||
return trace.startSpan(
|
||||
{
|
||||
name: `auth ${isAdmin ? '(admin) ' : ''}${operation.name}`,
|
||||
attributes: {
|
||||
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.supabase',
|
||||
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db',
|
||||
'db.system': 'postgresql',
|
||||
'db.operation': `auth.${isAdmin ? 'admin.' : ''}${operation.name}`,
|
||||
},
|
||||
},
|
||||
span => {
|
||||
return Reflect.apply(target, thisArg, argumentsList)
|
||||
.then((res) => {
|
||||
if (res && typeof res === 'object' && 'error' in res && res.error) {
|
||||
span.setStatus({ code: spanstatus.SPAN_STATUS_ERROR });
|
||||
|
||||
exports$1.captureException(res.error, {
|
||||
mechanism: {
|
||||
handled: false,
|
||||
},
|
||||
});
|
||||
} else {
|
||||
span.setStatus({ code: spanstatus.SPAN_STATUS_OK });
|
||||
}
|
||||
|
||||
span.end();
|
||||
return res;
|
||||
})
|
||||
.catch((err) => {
|
||||
span.setStatus({ code: spanstatus.SPAN_STATUS_ERROR });
|
||||
span.end();
|
||||
|
||||
exports$1.captureException(err, {
|
||||
mechanism: {
|
||||
handled: false,
|
||||
},
|
||||
});
|
||||
|
||||
throw err;
|
||||
})
|
||||
.then(...argumentsList);
|
||||
},
|
||||
);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function instrumentSupabaseAuthClient(supabaseClientInstance) {
|
||||
const auth = supabaseClientInstance.auth;
|
||||
|
||||
if (!auth || isInstrumented(supabaseClientInstance.auth)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const operation of AUTH_OPERATIONS_TO_INSTRUMENT) {
|
||||
const authOperation = auth[operation];
|
||||
|
||||
if (!authOperation) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof supabaseClientInstance.auth[operation] === 'function') {
|
||||
supabaseClientInstance.auth[operation] = instrumentAuthOperation(authOperation);
|
||||
}
|
||||
}
|
||||
|
||||
for (const operation of AUTH_ADMIN_OPERATIONS_TO_INSTRUMENT) {
|
||||
const authOperation = auth.admin[operation];
|
||||
|
||||
if (!authOperation) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof supabaseClientInstance.auth.admin[operation] === 'function') {
|
||||
supabaseClientInstance.auth.admin[operation] = instrumentAuthOperation(authOperation, true);
|
||||
}
|
||||
}
|
||||
|
||||
markAsInstrumented(supabaseClientInstance.auth);
|
||||
}
|
||||
|
||||
function instrumentSupabaseClientConstructor(SupabaseClient) {
|
||||
if (isInstrumented((SupabaseClient ).prototype.from)) {
|
||||
return;
|
||||
}
|
||||
|
||||
(SupabaseClient ).prototype.from = new Proxy(
|
||||
(SupabaseClient ).prototype.from,
|
||||
{
|
||||
apply(target, thisArg, argumentsList) {
|
||||
const rv = Reflect.apply(target, thisArg, argumentsList);
|
||||
const PostgRESTQueryBuilder = (rv ).constructor;
|
||||
|
||||
instrumentPostgRESTQueryBuilder(PostgRESTQueryBuilder );
|
||||
|
||||
return rv;
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
markAsInstrumented((SupabaseClient ).prototype.from);
|
||||
}
|
||||
|
||||
function instrumentPostgRESTFilterBuilder(PostgRESTFilterBuilder) {
|
||||
if (isInstrumented((PostgRESTFilterBuilder.prototype ).then)) {
|
||||
return;
|
||||
}
|
||||
|
||||
(PostgRESTFilterBuilder.prototype ).then = new Proxy(
|
||||
(PostgRESTFilterBuilder.prototype ).then,
|
||||
{
|
||||
apply(target, thisArg, argumentsList) {
|
||||
const operations = DB_OPERATIONS_TO_INSTRUMENT;
|
||||
const typedThis = thisArg ;
|
||||
const operation = extractOperation(typedThis.method, typedThis.headers);
|
||||
|
||||
if (!operations.includes(operation)) {
|
||||
return Reflect.apply(target, thisArg, argumentsList);
|
||||
}
|
||||
|
||||
if (!typedThis?.url?.pathname || typeof typedThis.url.pathname !== 'string') {
|
||||
return Reflect.apply(target, thisArg, argumentsList);
|
||||
}
|
||||
|
||||
const pathParts = typedThis.url.pathname.split('/');
|
||||
const table = pathParts.length > 0 ? pathParts[pathParts.length - 1] : '';
|
||||
|
||||
const queryItems = [];
|
||||
for (const [key, value] of typedThis.url.searchParams.entries()) {
|
||||
// It's possible to have multiple entries for the same key, eg. `id=eq.7&id=eq.3`,
|
||||
// so we need to use array instead of object to collect them.
|
||||
queryItems.push(translateFiltersIntoMethods(key, value));
|
||||
}
|
||||
const body = Object.create(null);
|
||||
if (is.isPlainObject(typedThis.body)) {
|
||||
for (const [key, value] of Object.entries(typedThis.body)) {
|
||||
body[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Adding operation to the beginning of the description if it's not a `select` operation
|
||||
// For example, it can be an `insert` or `update` operation but the query can be `select(...)`
|
||||
// For `select` operations, we don't need repeat it in the description
|
||||
const description = `${operation === 'select' ? '' : `${operation}${body ? '(...) ' : ''}`}${queryItems.join(
|
||||
' ',
|
||||
)} from(${table})`;
|
||||
|
||||
const attributes = {
|
||||
'db.table': table,
|
||||
'db.schema': typedThis.schema,
|
||||
'db.url': typedThis.url.origin,
|
||||
'db.sdk': typedThis.headers['X-Client-Info'],
|
||||
'db.system': 'postgresql',
|
||||
'db.operation': operation,
|
||||
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.supabase',
|
||||
[semanticAttributes.SEMANTIC_ATTRIBUTE_SENTRY_OP]: 'db',
|
||||
};
|
||||
|
||||
if (queryItems.length) {
|
||||
attributes['db.query'] = queryItems;
|
||||
}
|
||||
|
||||
if (Object.keys(body).length) {
|
||||
attributes['db.body'] = body;
|
||||
}
|
||||
|
||||
return trace.startSpan(
|
||||
{
|
||||
name: description,
|
||||
attributes,
|
||||
},
|
||||
span => {
|
||||
return (Reflect.apply(target, thisArg, []) )
|
||||
.then(
|
||||
(res) => {
|
||||
if (span) {
|
||||
if (res && typeof res === 'object' && 'status' in res) {
|
||||
spanstatus.setHttpStatus(span, res.status || 500);
|
||||
}
|
||||
span.end();
|
||||
}
|
||||
|
||||
if (res.error) {
|
||||
const err = new Error(res.error.message) ;
|
||||
if (res.error.code) {
|
||||
err.code = res.error.code;
|
||||
}
|
||||
if (res.error.details) {
|
||||
err.details = res.error.details;
|
||||
}
|
||||
|
||||
const supabaseContext = {};
|
||||
if (queryItems.length) {
|
||||
supabaseContext.query = queryItems;
|
||||
}
|
||||
if (Object.keys(body).length) {
|
||||
supabaseContext.body = body;
|
||||
}
|
||||
|
||||
exports$1.captureException(err, {
|
||||
contexts: {
|
||||
supabase: supabaseContext,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const breadcrumb = {
|
||||
type: 'supabase',
|
||||
category: `db.${operation}`,
|
||||
message: description,
|
||||
};
|
||||
|
||||
const data = {};
|
||||
|
||||
if (queryItems.length) {
|
||||
data.query = queryItems;
|
||||
}
|
||||
|
||||
if (Object.keys(body).length) {
|
||||
data.body = body;
|
||||
}
|
||||
|
||||
if (Object.keys(data).length) {
|
||||
breadcrumb.data = data;
|
||||
}
|
||||
|
||||
breadcrumbs.addBreadcrumb(breadcrumb);
|
||||
|
||||
return res;
|
||||
},
|
||||
(err) => {
|
||||
if (span) {
|
||||
spanstatus.setHttpStatus(span, 500);
|
||||
span.end();
|
||||
}
|
||||
throw err;
|
||||
},
|
||||
)
|
||||
.then(...argumentsList);
|
||||
},
|
||||
);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
markAsInstrumented((PostgRESTFilterBuilder.prototype ).then);
|
||||
}
|
||||
|
||||
function instrumentPostgRESTQueryBuilder(PostgRESTQueryBuilder) {
|
||||
// We need to wrap _all_ operations despite them sharing the same `PostgRESTFilterBuilder`
|
||||
// constructor, as we don't know which method will be called first, and we don't want to miss any calls.
|
||||
for (const operation of DB_OPERATIONS_TO_INSTRUMENT) {
|
||||
if (isInstrumented((PostgRESTQueryBuilder.prototype )[operation])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
(PostgRESTQueryBuilder.prototype )[operation ] = new Proxy(
|
||||
(PostgRESTQueryBuilder.prototype )[operation ],
|
||||
{
|
||||
apply(target, thisArg, argumentsList) {
|
||||
const rv = Reflect.apply(target, thisArg, argumentsList);
|
||||
const PostgRESTFilterBuilder = (rv ).constructor;
|
||||
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.log(`Instrumenting ${operation} operation's PostgRESTFilterBuilder`);
|
||||
|
||||
instrumentPostgRESTFilterBuilder(PostgRESTFilterBuilder);
|
||||
|
||||
return rv;
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
markAsInstrumented((PostgRESTQueryBuilder.prototype )[operation]);
|
||||
}
|
||||
}
|
||||
|
||||
const instrumentSupabaseClient = (supabaseClient) => {
|
||||
if (!supabaseClient) {
|
||||
debugBuild.DEBUG_BUILD && debugLogger.debug.warn('Supabase integration was not installed because no Supabase client was provided.');
|
||||
return;
|
||||
}
|
||||
const SupabaseClientConstructor =
|
||||
supabaseClient.constructor === Function ? supabaseClient : supabaseClient.constructor;
|
||||
|
||||
instrumentSupabaseClientConstructor(SupabaseClientConstructor);
|
||||
instrumentSupabaseAuthClient(supabaseClient );
|
||||
};
|
||||
|
||||
const INTEGRATION_NAME = 'Supabase';
|
||||
|
||||
const _supabaseIntegration = ((supabaseClient) => {
|
||||
return {
|
||||
setupOnce() {
|
||||
instrumentSupabaseClient(supabaseClient);
|
||||
},
|
||||
name: INTEGRATION_NAME,
|
||||
};
|
||||
}) ;
|
||||
|
||||
const supabaseIntegration = integration.defineIntegration((options) => {
|
||||
return _supabaseIntegration(options.supabaseClient);
|
||||
}) ;
|
||||
|
||||
exports.DB_OPERATIONS_TO_INSTRUMENT = DB_OPERATIONS_TO_INSTRUMENT;
|
||||
exports.FILTER_MAPPINGS = FILTER_MAPPINGS;
|
||||
exports.extractOperation = extractOperation;
|
||||
exports.instrumentSupabaseClient = instrumentSupabaseClient;
|
||||
exports.supabaseIntegration = supabaseIntegration;
|
||||
exports.translateFiltersIntoMethods = translateFiltersIntoMethods;
|
||||
//# sourceMappingURL=supabase.js.map
|
||||
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/supabase.js.map
generated
vendored
Executable file
1
dev/env/node_modules/@sentry/core/build/cjs/integrations/supabase.js.map
generated
vendored
Executable file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user