This commit is contained in:
MarSeventh
2024-07-19 23:26:06 +08:00
commit 4e0c55d1f9
1401 changed files with 69819 additions and 0 deletions

View File

@@ -0,0 +1,186 @@
import { _optionalChain } from '@sentry/utils';
import { loadModule, logger, fill, arrayify, isThenable } from '@sentry/utils';
import { DEBUG_BUILD } from '../../common/debug-build.js';
import { shouldDisableAutoInstrumentation } from './utils/node-utils.js';
/** Tracing integration for Apollo */
class Apollo {
/**
* @inheritDoc
*/
static __initStatic() {this.id = 'Apollo';}
/**
* @inheritDoc
*/
/**
* @inheritDoc
*/
constructor(
options = {
useNestjs: false,
},
) {
this.name = Apollo.id;
this._useNest = !!options.useNestjs;
}
/** @inheritdoc */
loadDependency() {
if (this._useNest) {
this._module = this._module || loadModule('@nestjs/graphql');
} else {
this._module = this._module || loadModule('apollo-server-core');
}
return this._module;
}
/**
* @inheritDoc
*/
// eslint-disable-next-line deprecation/deprecation
setupOnce(_, getCurrentHub) {
if (shouldDisableAutoInstrumentation(getCurrentHub)) {
DEBUG_BUILD && logger.log('Apollo Integration is skipped because of instrumenter configuration.');
return;
}
if (this._useNest) {
const pkg = this.loadDependency();
if (!pkg) {
DEBUG_BUILD && logger.error('Apollo-NestJS Integration was unable to require @nestjs/graphql package.');
return;
}
/**
* Iterate over resolvers of NestJS ResolversExplorerService before schemas are constructed.
*/
fill(
pkg.GraphQLFactory.prototype,
'mergeWithSchema',
function (orig) {
return function (
...args
) {
fill(this.resolversExplorerService, 'explore', function (orig) {
return function () {
const resolvers = arrayify(orig.call(this));
const instrumentedResolvers = instrumentResolvers(resolvers, getCurrentHub);
return instrumentedResolvers;
};
});
return orig.call(this, ...args);
};
},
);
} else {
const pkg = this.loadDependency();
if (!pkg) {
DEBUG_BUILD && logger.error('Apollo Integration was unable to require apollo-server-core package.');
return;
}
/**
* Iterate over resolvers of the ApolloServer instance before schemas are constructed.
*/
fill(pkg.ApolloServerBase.prototype, 'constructSchema', function (orig) {
return function (
) {
if (!this.config.resolvers) {
if (DEBUG_BUILD) {
if (this.config.schema) {
logger.warn(
'Apollo integration is not able to trace `ApolloServer` instances constructed via `schema` property.' +
'If you are using NestJS with Apollo, please use `Sentry.Integrations.Apollo({ useNestjs: true })` instead.',
);
logger.warn();
} else if (this.config.modules) {
logger.warn(
'Apollo integration is not able to trace `ApolloServer` instances constructed via `modules` property.',
);
}
logger.error('Skipping tracing as no resolvers found on the `ApolloServer` instance.');
}
return orig.call(this);
}
const resolvers = arrayify(this.config.resolvers);
this.config.resolvers = instrumentResolvers(resolvers, getCurrentHub);
return orig.call(this);
};
});
}
}
}Apollo.__initStatic();
// eslint-disable-next-line deprecation/deprecation
function instrumentResolvers(resolvers, getCurrentHub) {
return resolvers.map(model => {
Object.keys(model).forEach(resolverGroupName => {
Object.keys(model[resolverGroupName]).forEach(resolverName => {
if (typeof model[resolverGroupName][resolverName] !== 'function') {
return;
}
wrapResolver(model, resolverGroupName, resolverName, getCurrentHub);
});
});
return model;
});
}
/**
* Wrap a single resolver which can be a parent of other resolvers and/or db operations.
*/
function wrapResolver(
model,
resolverGroupName,
resolverName,
// eslint-disable-next-line deprecation/deprecation
getCurrentHub,
) {
fill(model[resolverGroupName], resolverName, function (orig) {
return function ( ...args) {
// eslint-disable-next-line deprecation/deprecation
const scope = getCurrentHub().getScope();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
// eslint-disable-next-line deprecation/deprecation
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({
description: `${resolverGroupName}.${resolverName}`,
op: 'graphql.resolve',
origin: 'auto.graphql.apollo',
})]);
const rv = orig.call(this, ...args);
if (isThenable(rv)) {
return rv.then((res) => {
_optionalChain([span, 'optionalAccess', _4 => _4.end, 'call', _5 => _5()]);
return res;
});
}
_optionalChain([span, 'optionalAccess', _6 => _6.end, 'call', _7 => _7()]);
return rv;
};
});
}
export { Apollo };
//# sourceMappingURL=apollo.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,488 @@
import { _optionalChain } from '@sentry/utils';
import { spanToJSON, SEMANTIC_ATTRIBUTE_SENTRY_SOURCE } from '@sentry/core';
import { logger, getNumberOfUrlSegments, stripUrlQueryAndFragment, extractPathForTransaction, isRegExp, GLOBAL_OBJ } from '@sentry/utils';
import { DEBUG_BUILD } from '../../common/debug-build.js';
import { shouldDisableAutoInstrumentation } from './utils/node-utils.js';
/* eslint-disable max-lines */
/**
* Express integration
*
* Provides an request and error handler for Express framework as well as tracing capabilities
*/
class Express {
/**
* @inheritDoc
*/
static __initStatic() {this.id = 'Express';}
/**
* @inheritDoc
*/
/**
* Express App instance
*/
/**
* @inheritDoc
*/
constructor(options = {}) {
this.name = Express.id;
this._router = options.router || options.app;
this._methods = (Array.isArray(options.methods) ? options.methods : []).concat('use');
}
/**
* @inheritDoc
*/
// eslint-disable-next-line deprecation/deprecation
setupOnce(_, getCurrentHub) {
if (!this._router) {
DEBUG_BUILD && logger.error('ExpressIntegration is missing an Express instance');
return;
}
if (shouldDisableAutoInstrumentation(getCurrentHub)) {
DEBUG_BUILD && logger.log('Express Integration is skipped because of instrumenter configuration.');
return;
}
instrumentMiddlewares(this._router, this._methods);
instrumentRouter(this._router );
}
}Express.__initStatic();
/**
* Wraps original middleware function in a tracing call, which stores the info about the call as a span,
* and finishes it once the middleware is done invoking.
*
* Express middlewares have 3 various forms, thus we have to take care of all of them:
* // sync
* app.use(function (req, res) { ... })
* // async
* app.use(function (req, res, next) { ... })
* // error handler
* app.use(function (err, req, res, next) { ... })
*
* They all internally delegate to the `router[method]` of the given application instance.
*/
// eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-explicit-any
function wrap(fn, method) {
const arity = fn.length;
switch (arity) {
case 2: {
return function ( req, res) {
const transaction = res.__sentry_transaction;
if (transaction) {
// eslint-disable-next-line deprecation/deprecation
const span = transaction.startChild({
description: fn.name,
op: `middleware.express.${method}`,
origin: 'auto.middleware.express',
});
res.once('finish', () => {
span.end();
});
}
return fn.call(this, req, res);
};
}
case 3: {
return function (
req,
res,
next,
) {
const transaction = res.__sentry_transaction;
// eslint-disable-next-line deprecation/deprecation
const span = _optionalChain([transaction, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({
description: fn.name,
op: `middleware.express.${method}`,
origin: 'auto.middleware.express',
})]);
fn.call(this, req, res, function ( ...args) {
_optionalChain([span, 'optionalAccess', _4 => _4.end, 'call', _5 => _5()]);
next.call(this, ...args);
});
};
}
case 4: {
return function (
err,
req,
res,
next,
) {
const transaction = res.__sentry_transaction;
// eslint-disable-next-line deprecation/deprecation
const span = _optionalChain([transaction, 'optionalAccess', _6 => _6.startChild, 'call', _7 => _7({
description: fn.name,
op: `middleware.express.${method}`,
origin: 'auto.middleware.express',
})]);
fn.call(this, err, req, res, function ( ...args) {
_optionalChain([span, 'optionalAccess', _8 => _8.end, 'call', _9 => _9()]);
next.call(this, ...args);
});
};
}
default: {
throw new Error(`Express middleware takes 2-4 arguments. Got: ${arity}`);
}
}
}
/**
* Takes all the function arguments passed to the original `app` or `router` method, eg. `app.use` or `router.use`
* and wraps every function, as well as array of functions with a call to our `wrap` method.
* We have to take care of the arrays as well as iterate over all of the arguments,
* as `app.use` can accept middlewares in few various forms.
*
* app.use([<path>], <fn>)
* app.use([<path>], <fn>, ...<fn>)
* app.use([<path>], ...<fn>[])
*/
function wrapMiddlewareArgs(args, method) {
return args.map((arg) => {
if (typeof arg === 'function') {
return wrap(arg, method);
}
if (Array.isArray(arg)) {
return arg.map((a) => {
if (typeof a === 'function') {
return wrap(a, method);
}
return a;
});
}
return arg;
});
}
/**
* Patches original router to utilize our tracing functionality
*/
function patchMiddleware(router, method) {
const originalCallback = router[method];
router[method] = function (...args) {
return originalCallback.call(this, ...wrapMiddlewareArgs(args, method));
};
return router;
}
/**
* Patches original router methods
*/
function instrumentMiddlewares(router, methods = []) {
methods.forEach((method) => patchMiddleware(router, method));
}
/**
* Patches the prototype of Express.Router to accumulate the resolved route
* if a layer instance's `match` function was called and it returned a successful match.
*
* @see https://github.com/expressjs/express/blob/master/lib/router/index.js
*
* @param appOrRouter the router instance which can either be an app (i.e. top-level) or a (nested) router.
*/
function instrumentRouter(appOrRouter) {
// This is how we can distinguish between app and routers
const isApp = 'settings' in appOrRouter;
// In case the app's top-level router hasn't been initialized yet, we have to do it now
if (isApp && appOrRouter._router === undefined && appOrRouter.lazyrouter) {
appOrRouter.lazyrouter();
}
const router = isApp ? appOrRouter._router : appOrRouter;
if (!router) {
/*
If we end up here, this means likely that this integration is used with Express 3 or Express 5.
For now, we don't support these versions (3 is very old and 5 is still in beta). To support Express 5,
we'd need to make more changes to the routing instrumentation because the router is no longer part of
the Express core package but maintained in its own package. The new router has different function
signatures and works slightly differently, demanding more changes than just taking the router from
`app.router` instead of `app._router`.
@see https://github.com/pillarjs/router
TODO: Proper Express 5 support
*/
DEBUG_BUILD && logger.debug('Cannot instrument router for URL Parameterization (did not find a valid router).');
DEBUG_BUILD && logger.debug('Routing instrumentation is currently only supported in Express 4.');
return;
}
const routerProto = Object.getPrototypeOf(router) ;
const originalProcessParams = routerProto.process_params;
routerProto.process_params = function process_params(
layer,
called,
req,
res,
done,
) {
// Base case: We're in the first part of the URL (thus we start with the root '/')
if (!req._reconstructedRoute) {
req._reconstructedRoute = '';
}
// If the layer's partial route has params, is a regex or an array, the route is stored in layer.route.
const { layerRoutePath, isRegex, isArray, numExtraSegments } = getLayerRoutePathInfo(layer);
if (layerRoutePath || isRegex || isArray) {
req._hasParameters = true;
}
// Otherwise, the hardcoded path (i.e. a partial route without params) is stored in layer.path
let partialRoute;
if (layerRoutePath) {
partialRoute = layerRoutePath;
} else {
/**
* prevent duplicate segment in _reconstructedRoute param if router match multiple routes before final path
* example:
* original url: /api/v1/1234
* prevent: /api/api/v1/:userId
* router structure
* /api -> middleware
* /api/v1 -> middleware
* /1234 -> endpoint with param :userId
* final _reconstructedRoute is /api/v1/:userId
*/
partialRoute = preventDuplicateSegments(req.originalUrl, req._reconstructedRoute, layer.path) || '';
}
// Normalize the partial route so that it doesn't contain leading or trailing slashes
// and exclude empty or '*' wildcard routes.
// The exclusion of '*' routes is our best effort to not "pollute" the transaction name
// with interim handlers (e.g. ones that check authentication or do other middleware stuff).
// We want to end up with the parameterized URL of the incoming request without any extraneous path segments.
const finalPartialRoute = partialRoute
.split('/')
.filter(segment => segment.length > 0 && (isRegex || isArray || !segment.includes('*')))
.join('/');
// If we found a valid partial URL, we append it to the reconstructed route
if (finalPartialRoute && finalPartialRoute.length > 0) {
// If the partial route is from a regex route, we append a '/' to close the regex
req._reconstructedRoute += `/${finalPartialRoute}${isRegex ? '/' : ''}`;
}
// Now we check if we are in the "last" part of the route. We determine this by comparing the
// number of URL segments from the original URL to that of our reconstructed parameterized URL.
// If we've reached our final destination, we update the transaction name.
const urlLength = getNumberOfUrlSegments(stripUrlQueryAndFragment(req.originalUrl || '')) + numExtraSegments;
const routeLength = getNumberOfUrlSegments(req._reconstructedRoute);
if (urlLength === routeLength) {
if (!req._hasParameters) {
if (req._reconstructedRoute !== req.originalUrl) {
req._reconstructedRoute = req.originalUrl ? stripUrlQueryAndFragment(req.originalUrl) : req.originalUrl;
}
}
const transaction = res.__sentry_transaction;
const attributes = (transaction && spanToJSON(transaction).data) || {};
if (transaction && attributes[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE] !== 'custom') {
// If the request URL is '/' or empty, the reconstructed route will be empty.
// Therefore, we fall back to setting the final route to '/' in this case.
const finalRoute = req._reconstructedRoute || '/';
const [name, source] = extractPathForTransaction(req, { path: true, method: true, customRoute: finalRoute });
transaction.updateName(name);
transaction.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, source);
}
}
return originalProcessParams.call(this, layer, called, req, res, done);
};
}
/**
* Recreate layer.route.path from layer.regexp and layer.keys.
* Works until express.js used package path-to-regexp@0.1.7
* or until layer.keys contain offset attribute
*
* @param layer the layer to extract the stringified route from
*
* @returns string in layer.route.path structure 'router/:pathParam' or undefined
*/
const extractOriginalRoute = (
path,
regexp,
keys,
) => {
if (!path || !regexp || !keys || Object.keys(keys).length === 0 || !_optionalChain([keys, 'access', _10 => _10[0], 'optionalAccess', _11 => _11.offset])) {
return undefined;
}
const orderedKeys = keys.sort((a, b) => a.offset - b.offset);
// add d flag for getting indices from regexp result
// eslint-disable-next-line @sentry-internal/sdk/no-regexp-constructor -- regexp comes from express.js
const pathRegex = new RegExp(regexp, `${regexp.flags}d`);
/**
* use custom type cause of TS error with missing indices in RegExpExecArray
*/
const execResult = pathRegex.exec(path) ;
if (!execResult || !execResult.indices) {
return undefined;
}
/**
* remove first match from regex cause contain whole layer.path
*/
const [, ...paramIndices] = execResult.indices;
if (paramIndices.length !== orderedKeys.length) {
return undefined;
}
let resultPath = path;
let indexShift = 0;
/**
* iterate param matches from regexp.exec
*/
paramIndices.forEach((item, index) => {
/** check if offsets is define because in some cases regex d flag returns undefined */
if (item) {
const [startOffset, endOffset] = item;
/**
* isolate part before param
*/
const substr1 = resultPath.substring(0, startOffset - indexShift);
/**
* define paramName as replacement in format :pathParam
*/
const replacement = `:${orderedKeys[index].name}`;
/**
* isolate part after param
*/
const substr2 = resultPath.substring(endOffset - indexShift);
/**
* recreate original path but with param replacement
*/
resultPath = substr1 + replacement + substr2;
/**
* calculate new index shift after resultPath was modified
*/
indexShift = indexShift + (endOffset - startOffset - replacement.length);
}
});
return resultPath;
};
/**
* Extracts and stringifies the layer's route which can either be a string with parameters (`users/:id`),
* a RegEx (`/test/`) or an array of strings and regexes (`['/path1', /\/path[2-5]/, /path/:id]`). Additionally
* returns extra information about the route, such as if the route is defined as regex or as an array.
*
* @param layer the layer to extract the stringified route from
*
* @returns an object containing the stringified route, a flag determining if the route was a regex
* and the number of extra segments to the matched path that are additionally in the route,
* if the route was an array (defaults to 0).
*/
function getLayerRoutePathInfo(layer) {
let lrp = _optionalChain([layer, 'access', _12 => _12.route, 'optionalAccess', _13 => _13.path]);
const isRegex = isRegExp(lrp);
const isArray = Array.isArray(lrp);
if (!lrp) {
// parse node.js major version
// Next.js will complain if we directly use `proces.versions` here because of edge runtime.
const [major] = (GLOBAL_OBJ ).process.versions.node.split('.').map(Number);
// allow call extractOriginalRoute only if node version support Regex d flag, node 16+
if (major >= 16) {
/**
* If lrp does not exist try to recreate original layer path from route regexp
*/
lrp = extractOriginalRoute(layer.path, layer.regexp, layer.keys);
}
}
if (!lrp) {
return { isRegex, isArray, numExtraSegments: 0 };
}
const numExtraSegments = isArray
? Math.max(getNumberOfArrayUrlSegments(lrp ) - getNumberOfUrlSegments(layer.path || ''), 0)
: 0;
const layerRoutePath = getLayerRoutePathString(isArray, lrp);
return { layerRoutePath, isRegex, isArray, numExtraSegments };
}
/**
* Returns the number of URL segments in an array of routes
*
* Example: ['/api/test', /\/api\/post[0-9]/, '/users/:id/details`] -> 7
*/
function getNumberOfArrayUrlSegments(routesArray) {
return routesArray.reduce((accNumSegments, currentRoute) => {
// array members can be a RegEx -> convert them toString
return accNumSegments + getNumberOfUrlSegments(currentRoute.toString());
}, 0);
}
/**
* Extracts and returns the stringified version of the layers route path
* Handles route arrays (by joining the paths together) as well as RegExp and normal
* string values (in the latter case the toString conversion is technically unnecessary but
* it doesn't hurt us either).
*/
function getLayerRoutePathString(isArray, lrp) {
if (isArray) {
return (lrp ).map(r => r.toString()).join(',');
}
return lrp && lrp.toString();
}
/**
* remove duplicate segment contain in layerPath against reconstructedRoute,
* and return only unique segment that can be added into reconstructedRoute
*/
function preventDuplicateSegments(
originalUrl,
reconstructedRoute,
layerPath,
) {
// filter query params
const normalizeURL = stripUrlQueryAndFragment(originalUrl || '');
const originalUrlSplit = _optionalChain([normalizeURL, 'optionalAccess', _14 => _14.split, 'call', _15 => _15('/'), 'access', _16 => _16.filter, 'call', _17 => _17(v => !!v)]);
let tempCounter = 0;
const currentOffset = _optionalChain([reconstructedRoute, 'optionalAccess', _18 => _18.split, 'call', _19 => _19('/'), 'access', _20 => _20.filter, 'call', _21 => _21(v => !!v), 'access', _22 => _22.length]) || 0;
const result = _optionalChain([layerPath
, 'optionalAccess', _23 => _23.split, 'call', _24 => _24('/')
, 'access', _25 => _25.filter, 'call', _26 => _26(segment => {
if (_optionalChain([originalUrlSplit, 'optionalAccess', _27 => _27[currentOffset + tempCounter]]) === segment) {
tempCounter += 1;
return true;
}
return false;
})
, 'access', _28 => _28.join, 'call', _29 => _29('/')]);
return result;
}
export { Express, extractOriginalRoute, preventDuplicateSegments };
//# sourceMappingURL=express.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,82 @@
import { _optionalChain } from '@sentry/utils';
import { loadModule, logger, fill, isThenable } from '@sentry/utils';
import { DEBUG_BUILD } from '../../common/debug-build.js';
import { shouldDisableAutoInstrumentation } from './utils/node-utils.js';
/** Tracing integration for graphql package */
class GraphQL {
/**
* @inheritDoc
*/
static __initStatic() {this.id = 'GraphQL';}
/**
* @inheritDoc
*/
constructor() {
this.name = GraphQL.id;
}
/** @inheritdoc */
loadDependency() {
return (this._module = this._module || loadModule('graphql/execution/execute.js'));
}
/**
* @inheritDoc
*/
// eslint-disable-next-line deprecation/deprecation
setupOnce(_, getCurrentHub) {
if (shouldDisableAutoInstrumentation(getCurrentHub)) {
DEBUG_BUILD && logger.log('GraphQL Integration is skipped because of instrumenter configuration.');
return;
}
const pkg = this.loadDependency();
if (!pkg) {
DEBUG_BUILD && logger.error('GraphQL Integration was unable to require graphql/execution package.');
return;
}
fill(pkg, 'execute', function (orig) {
return function ( ...args) {
// eslint-disable-next-line deprecation/deprecation
const scope = getCurrentHub().getScope();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
// eslint-disable-next-line deprecation/deprecation
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({
description: 'execute',
op: 'graphql.execute',
origin: 'auto.graphql.graphql',
})]);
// eslint-disable-next-line deprecation/deprecation
_optionalChain([scope, 'optionalAccess', _4 => _4.setSpan, 'call', _5 => _5(span)]);
const rv = orig.call(this, ...args);
if (isThenable(rv)) {
return rv.then((res) => {
_optionalChain([span, 'optionalAccess', _6 => _6.end, 'call', _7 => _7()]);
// eslint-disable-next-line deprecation/deprecation
_optionalChain([scope, 'optionalAccess', _8 => _8.setSpan, 'call', _9 => _9(parentSpan)]);
return res;
});
}
_optionalChain([span, 'optionalAccess', _10 => _10.end, 'call', _11 => _11()]);
// eslint-disable-next-line deprecation/deprecation
_optionalChain([scope, 'optionalAccess', _12 => _12.setSpan, 'call', _13 => _13(parentSpan)]);
return rv;
};
});
}
}GraphQL.__initStatic();
export { GraphQL };
//# sourceMappingURL=graphql.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,49 @@
import { dynamicRequire } from '@sentry/utils';
const lazyLoadedNodePerformanceMonitoringIntegrations = [
() => {
const integration = dynamicRequire(module, './apollo')
;
return new integration.Apollo();
},
() => {
const integration = dynamicRequire(module, './apollo')
;
return new integration.Apollo({ useNestjs: true });
},
() => {
const integration = dynamicRequire(module, './graphql')
;
return new integration.GraphQL();
},
() => {
const integration = dynamicRequire(module, './mongo')
;
return new integration.Mongo();
},
() => {
const integration = dynamicRequire(module, './mongo')
;
return new integration.Mongo({ mongoose: true });
},
() => {
const integration = dynamicRequire(module, './mysql')
;
return new integration.Mysql();
},
() => {
const integration = dynamicRequire(module, './postgres')
;
return new integration.Postgres();
},
];
export { lazyLoadedNodePerformanceMonitoringIntegrations };
//# sourceMappingURL=lazy.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"lazy.js","sources":["../../../../src/node/integrations/lazy.ts"],"sourcesContent":["import type { Integration, IntegrationClass } from '@sentry/types';\nimport { dynamicRequire } from '@sentry/utils';\n\nexport interface LazyLoadedIntegration<T = object> extends Integration {\n /**\n * Loads the integration's dependency and caches it so it doesn't have to be loaded again.\n *\n * If this returns undefined, the dependency could not be loaded.\n */\n loadDependency(): T | undefined;\n}\n\nexport const lazyLoadedNodePerformanceMonitoringIntegrations: (() => LazyLoadedIntegration)[] = [\n () => {\n const integration = dynamicRequire(module, './apollo') as {\n Apollo: IntegrationClass<LazyLoadedIntegration>;\n };\n return new integration.Apollo();\n },\n () => {\n const integration = dynamicRequire(module, './apollo') as {\n Apollo: IntegrationClass<LazyLoadedIntegration>;\n };\n return new integration.Apollo({ useNestjs: true });\n },\n () => {\n const integration = dynamicRequire(module, './graphql') as {\n GraphQL: IntegrationClass<LazyLoadedIntegration>;\n };\n return new integration.GraphQL();\n },\n () => {\n const integration = dynamicRequire(module, './mongo') as {\n Mongo: IntegrationClass<LazyLoadedIntegration>;\n };\n return new integration.Mongo();\n },\n () => {\n const integration = dynamicRequire(module, './mongo') as {\n Mongo: IntegrationClass<LazyLoadedIntegration>;\n };\n return new integration.Mongo({ mongoose: true });\n },\n () => {\n const integration = dynamicRequire(module, './mysql') as {\n Mysql: IntegrationClass<LazyLoadedIntegration>;\n };\n return new integration.Mysql();\n },\n () => {\n const integration = dynamicRequire(module, './postgres') as {\n Postgres: IntegrationClass<LazyLoadedIntegration>;\n };\n return new integration.Postgres();\n },\n];\n"],"names":[],"mappings":";;AAYO,MAAM,+CAA+C,GAAoC;AAChG,EAAE,MAAM;AACR,IAAI,MAAM,cAAc,cAAc,CAAC,MAAM,EAAE,UAAU,CAAE;;AAEvD,CAAA;AACJ,IAAI,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,CAAA;AACnC,GAAG;AACH,EAAE,MAAM;AACR,IAAI,MAAM,cAAc,cAAc,CAAC,MAAM,EAAE,UAAU,CAAE;;AAEvD,CAAA;AACJ,IAAI,OAAO,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAK,EAAC,CAAC,CAAA;AACtD,GAAG;AACH,EAAE,MAAM;AACR,IAAI,MAAM,cAAc,cAAc,CAAC,MAAM,EAAE,WAAW,CAAE;;AAExD,CAAA;AACJ,IAAI,OAAO,IAAI,WAAW,CAAC,OAAO,EAAE,CAAA;AACpC,GAAG;AACH,EAAE,MAAM;AACR,IAAI,MAAM,cAAc,cAAc,CAAC,MAAM,EAAE,SAAS,CAAE;;AAEtD,CAAA;AACJ,IAAI,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,CAAA;AAClC,GAAG;AACH,EAAE,MAAM;AACR,IAAI,MAAM,cAAc,cAAc,CAAC,MAAM,EAAE,SAAS,CAAE;;AAEtD,CAAA;AACJ,IAAI,OAAO,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAK,EAAC,CAAC,CAAA;AACpD,GAAG;AACH,EAAE,MAAM;AACR,IAAI,MAAM,cAAc,cAAc,CAAC,MAAM,EAAE,SAAS,CAAE;;AAEtD,CAAA;AACJ,IAAI,OAAO,IAAI,WAAW,CAAC,KAAK,EAAE,CAAA;AAClC,GAAG;AACH,EAAE,MAAM;AACR,IAAI,MAAM,cAAc,cAAc,CAAC,MAAM,EAAE,YAAY,CAAE;;AAEzD,CAAA;AACJ,IAAI,OAAO,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAA;AACrC,GAAG;AACH;;;;"}

View File

@@ -0,0 +1,260 @@
import { _optionalChain } from '@sentry/utils';
import { loadModule, logger, fill, isThenable } from '@sentry/utils';
import { DEBUG_BUILD } from '../../common/debug-build.js';
import { shouldDisableAutoInstrumentation } from './utils/node-utils.js';
// This allows us to use the same array for both defaults options and the type itself.
// (note `as const` at the end to make it a union of string literal types (i.e. "a" | "b" | ... )
// and not just a string[])
const OPERATIONS = [
'aggregate', // aggregate(pipeline, options, callback)
'bulkWrite', // bulkWrite(operations, options, callback)
'countDocuments', // countDocuments(query, options, callback)
'createIndex', // createIndex(fieldOrSpec, options, callback)
'createIndexes', // createIndexes(indexSpecs, options, callback)
'deleteMany', // deleteMany(filter, options, callback)
'deleteOne', // deleteOne(filter, options, callback)
'distinct', // distinct(key, query, options, callback)
'drop', // drop(options, callback)
'dropIndex', // dropIndex(indexName, options, callback)
'dropIndexes', // dropIndexes(options, callback)
'estimatedDocumentCount', // estimatedDocumentCount(options, callback)
'find', // find(query, options, callback)
'findOne', // findOne(query, options, callback)
'findOneAndDelete', // findOneAndDelete(filter, options, callback)
'findOneAndReplace', // findOneAndReplace(filter, replacement, options, callback)
'findOneAndUpdate', // findOneAndUpdate(filter, update, options, callback)
'indexes', // indexes(options, callback)
'indexExists', // indexExists(indexes, options, callback)
'indexInformation', // indexInformation(options, callback)
'initializeOrderedBulkOp', // initializeOrderedBulkOp(options, callback)
'insertMany', // insertMany(docs, options, callback)
'insertOne', // insertOne(doc, options, callback)
'isCapped', // isCapped(options, callback)
'mapReduce', // mapReduce(map, reduce, options, callback)
'options', // options(options, callback)
'parallelCollectionScan', // parallelCollectionScan(options, callback)
'rename', // rename(newName, options, callback)
'replaceOne', // replaceOne(filter, doc, options, callback)
'stats', // stats(options, callback)
'updateMany', // updateMany(filter, update, options, callback)
'updateOne', // updateOne(filter, update, options, callback)
] ;
// All of the operations above take `options` and `callback` as their final parameters, but some of them
// take additional parameters as well. For those operations, this is a map of
// { <operation name>: [<names of additional parameters>] }, as a way to know what to call the operation's
// positional arguments when we add them to the span's `data` object later
const OPERATION_SIGNATURES
= {
// aggregate intentionally not included because `pipeline` arguments are too complex to serialize well
// see https://github.com/getsentry/sentry-javascript/pull/3102
bulkWrite: ['operations'],
countDocuments: ['query'],
createIndex: ['fieldOrSpec'],
createIndexes: ['indexSpecs'],
deleteMany: ['filter'],
deleteOne: ['filter'],
distinct: ['key', 'query'],
dropIndex: ['indexName'],
find: ['query'],
findOne: ['query'],
findOneAndDelete: ['filter'],
findOneAndReplace: ['filter', 'replacement'],
findOneAndUpdate: ['filter', 'update'],
indexExists: ['indexes'],
insertMany: ['docs'],
insertOne: ['doc'],
mapReduce: ['map', 'reduce'],
rename: ['newName'],
replaceOne: ['filter', 'doc'],
updateMany: ['filter', 'update'],
updateOne: ['filter', 'update'],
};
function isCursor(maybeCursor) {
return maybeCursor && typeof maybeCursor === 'object' && maybeCursor.once && typeof maybeCursor.once === 'function';
}
/** Tracing integration for mongo package */
class Mongo {
/**
* @inheritDoc
*/
static __initStatic() {this.id = 'Mongo';}
/**
* @inheritDoc
*/
/**
* @inheritDoc
*/
constructor(options = {}) {
this.name = Mongo.id;
this._operations = Array.isArray(options.operations) ? options.operations : (OPERATIONS );
this._describeOperations = 'describeOperations' in options ? options.describeOperations : true;
this._useMongoose = !!options.useMongoose;
}
/** @inheritdoc */
loadDependency() {
const moduleName = this._useMongoose ? 'mongoose' : 'mongodb';
return (this._module = this._module || loadModule(moduleName));
}
/**
* @inheritDoc
*/
// eslint-disable-next-line deprecation/deprecation
setupOnce(_, getCurrentHub) {
if (shouldDisableAutoInstrumentation(getCurrentHub)) {
DEBUG_BUILD && logger.log('Mongo Integration is skipped because of instrumenter configuration.');
return;
}
const pkg = this.loadDependency();
if (!pkg) {
const moduleName = this._useMongoose ? 'mongoose' : 'mongodb';
DEBUG_BUILD && logger.error(`Mongo Integration was unable to require \`${moduleName}\` package.`);
return;
}
this._instrumentOperations(pkg.Collection, this._operations, getCurrentHub);
}
/**
* Patches original collection methods
*/
// eslint-disable-next-line deprecation/deprecation
_instrumentOperations(collection, operations, getCurrentHub) {
operations.forEach((operation) => this._patchOperation(collection, operation, getCurrentHub));
}
/**
* Patches original collection to utilize our tracing functionality
*/
// eslint-disable-next-line deprecation/deprecation
_patchOperation(collection, operation, getCurrentHub) {
if (!(operation in collection.prototype)) return;
const getSpanContext = this._getSpanContextFromOperationArguments.bind(this);
fill(collection.prototype, operation, function (orig) {
return function ( ...args) {
const lastArg = args[args.length - 1];
// eslint-disable-next-line deprecation/deprecation
const hub = getCurrentHub();
// eslint-disable-next-line deprecation/deprecation
const scope = hub.getScope();
// eslint-disable-next-line deprecation/deprecation
const client = hub.getClient();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
const sendDefaultPii = _optionalChain([client, 'optionalAccess', _2 => _2.getOptions, 'call', _3 => _3(), 'access', _4 => _4.sendDefaultPii]);
// Check if the operation was passed a callback. (mapReduce requires a different check, as
// its (non-callback) arguments can also be functions.)
if (typeof lastArg !== 'function' || (operation === 'mapReduce' && args.length === 2)) {
// eslint-disable-next-line deprecation/deprecation
const span = _optionalChain([parentSpan, 'optionalAccess', _5 => _5.startChild, 'call', _6 => _6(getSpanContext(this, operation, args, sendDefaultPii))]);
const maybePromiseOrCursor = orig.call(this, ...args);
if (isThenable(maybePromiseOrCursor)) {
return maybePromiseOrCursor.then((res) => {
_optionalChain([span, 'optionalAccess', _7 => _7.end, 'call', _8 => _8()]);
return res;
});
}
// If the operation returns a Cursor
// we need to attach a listener to it to finish the span when the cursor is closed.
else if (isCursor(maybePromiseOrCursor)) {
const cursor = maybePromiseOrCursor ;
try {
cursor.once('close', () => {
_optionalChain([span, 'optionalAccess', _9 => _9.end, 'call', _10 => _10()]);
});
} catch (e) {
// If the cursor is already closed, `once` will throw an error. In that case, we can
// finish the span immediately.
_optionalChain([span, 'optionalAccess', _11 => _11.end, 'call', _12 => _12()]);
}
return cursor;
} else {
_optionalChain([span, 'optionalAccess', _13 => _13.end, 'call', _14 => _14()]);
return maybePromiseOrCursor;
}
}
// eslint-disable-next-line deprecation/deprecation
const span = _optionalChain([parentSpan, 'optionalAccess', _15 => _15.startChild, 'call', _16 => _16(getSpanContext(this, operation, args.slice(0, -1)))]);
return orig.call(this, ...args.slice(0, -1), function (err, result) {
_optionalChain([span, 'optionalAccess', _17 => _17.end, 'call', _18 => _18()]);
lastArg(err, result);
});
};
});
}
/**
* Form a SpanContext based on the user input to a given operation.
*/
_getSpanContextFromOperationArguments(
collection,
operation,
args,
sendDefaultPii = false,
) {
const data = {
'db.system': 'mongodb',
'db.name': collection.dbName,
'db.operation': operation,
'db.mongodb.collection': collection.collectionName,
};
const spanContext = {
op: 'db',
// TODO v8: Use `${collection.collectionName}.${operation}`
origin: 'auto.db.mongo',
description: operation,
data,
};
// If the operation takes no arguments besides `options` and `callback`, or if argument
// collection is disabled for this operation, just return early.
const signature = OPERATION_SIGNATURES[operation];
const shouldDescribe = Array.isArray(this._describeOperations)
? this._describeOperations.includes(operation)
: this._describeOperations;
if (!signature || !shouldDescribe || !sendDefaultPii) {
return spanContext;
}
try {
// Special case for `mapReduce`, as the only one accepting functions as arguments.
if (operation === 'mapReduce') {
const [map, reduce] = args ;
data[signature[0]] = typeof map === 'string' ? map : map.name || '<anonymous>';
data[signature[1]] = typeof reduce === 'string' ? reduce : reduce.name || '<anonymous>';
} else {
for (let i = 0; i < signature.length; i++) {
data[`db.mongodb.${signature[i]}`] = JSON.stringify(args[i]);
}
}
} catch (_oO) {
// no-empty
}
return spanContext;
}
}Mongo.__initStatic();
export { Mongo };
//# sourceMappingURL=mongo.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,131 @@
import { _optionalChain } from '@sentry/utils';
import { loadModule, logger, fill } from '@sentry/utils';
import { DEBUG_BUILD } from '../../common/debug-build.js';
import { shouldDisableAutoInstrumentation } from './utils/node-utils.js';
/** Tracing integration for node-mysql package */
class Mysql {
/**
* @inheritDoc
*/
static __initStatic() {this.id = 'Mysql';}
/**
* @inheritDoc
*/
constructor() {
this.name = Mysql.id;
}
/** @inheritdoc */
loadDependency() {
return (this._module = this._module || loadModule('mysql/lib/Connection.js'));
}
/**
* @inheritDoc
*/
// eslint-disable-next-line deprecation/deprecation
setupOnce(_, getCurrentHub) {
if (shouldDisableAutoInstrumentation(getCurrentHub)) {
DEBUG_BUILD && logger.log('Mysql Integration is skipped because of instrumenter configuration.');
return;
}
const pkg = this.loadDependency();
if (!pkg) {
DEBUG_BUILD && logger.error('Mysql Integration was unable to require `mysql` package.');
return;
}
let mySqlConfig = undefined;
try {
pkg.prototype.connect = new Proxy(pkg.prototype.connect, {
apply(wrappingTarget, thisArg, args) {
if (!mySqlConfig) {
mySqlConfig = thisArg.config;
}
return wrappingTarget.apply(thisArg, args);
},
});
} catch (e) {
DEBUG_BUILD && logger.error('Mysql Integration was unable to instrument `mysql` config.');
}
function spanDataFromConfig() {
if (!mySqlConfig) {
return {};
}
return {
'server.address': mySqlConfig.host,
'server.port': mySqlConfig.port,
'db.user': mySqlConfig.user,
};
}
function finishSpan(span) {
if (!span) {
return;
}
const data = spanDataFromConfig();
Object.keys(data).forEach(key => {
span.setAttribute(key, data[key]);
});
span.end();
}
// The original function will have one of these signatures:
// function (callback) => void
// function (options, callback) => void
// function (options, values, callback) => void
fill(pkg, 'createQuery', function (orig) {
return function ( options, values, callback) {
// eslint-disable-next-line deprecation/deprecation
const scope = getCurrentHub().getScope();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
// eslint-disable-next-line deprecation/deprecation
const span = _optionalChain([parentSpan, 'optionalAccess', _2 => _2.startChild, 'call', _3 => _3({
description: typeof options === 'string' ? options : (options ).sql,
op: 'db',
origin: 'auto.db.mysql',
data: {
'db.system': 'mysql',
},
})]);
if (typeof callback === 'function') {
return orig.call(this, options, values, function (err, result, fields) {
finishSpan(span);
callback(err, result, fields);
});
}
if (typeof values === 'function') {
return orig.call(this, options, function (err, result, fields) {
finishSpan(span);
values(err, result, fields);
});
}
// streaming, no callback!
const query = orig.call(this, options, values) ;
query.on('end', () => {
finishSpan(span);
});
return query;
};
});
}
}Mysql.__initStatic();
export { Mysql };
//# sourceMappingURL=mysql.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,126 @@
import { _optionalChain } from '@sentry/utils';
import { loadModule, logger, fill, isThenable } from '@sentry/utils';
import { DEBUG_BUILD } from '../../common/debug-build.js';
import { shouldDisableAutoInstrumentation } from './utils/node-utils.js';
/** Tracing integration for node-postgres package */
class Postgres {
/**
* @inheritDoc
*/
static __initStatic() {this.id = 'Postgres';}
/**
* @inheritDoc
*/
constructor(options = {}) {
this.name = Postgres.id;
this._usePgNative = !!options.usePgNative;
this._module = options.module;
}
/** @inheritdoc */
loadDependency() {
return (this._module = this._module || loadModule('pg'));
}
/**
* @inheritDoc
*/
// eslint-disable-next-line deprecation/deprecation
setupOnce(_, getCurrentHub) {
if (shouldDisableAutoInstrumentation(getCurrentHub)) {
DEBUG_BUILD && logger.log('Postgres Integration is skipped because of instrumenter configuration.');
return;
}
const pkg = this.loadDependency();
if (!pkg) {
DEBUG_BUILD && logger.error('Postgres Integration was unable to require `pg` package.');
return;
}
const Client = this._usePgNative ? _optionalChain([pkg, 'access', _2 => _2.native, 'optionalAccess', _3 => _3.Client]) : pkg.Client;
if (!Client) {
DEBUG_BUILD && logger.error("Postgres Integration was unable to access 'pg-native' bindings.");
return;
}
/**
* function (query, callback) => void
* function (query, params, callback) => void
* function (query) => Promise
* function (query, params) => Promise
* function (pg.Cursor) => pg.Cursor
*/
fill(Client.prototype, 'query', function (orig) {
return function ( config, values, callback) {
// eslint-disable-next-line deprecation/deprecation
const scope = getCurrentHub().getScope();
// eslint-disable-next-line deprecation/deprecation
const parentSpan = scope.getSpan();
const data = {
'db.system': 'postgresql',
};
try {
if (this.database) {
data['db.name'] = this.database;
}
if (this.host) {
data['server.address'] = this.host;
}
if (this.port) {
data['server.port'] = this.port;
}
if (this.user) {
data['db.user'] = this.user;
}
} catch (e) {
// ignore
}
// eslint-disable-next-line deprecation/deprecation
const span = _optionalChain([parentSpan, 'optionalAccess', _4 => _4.startChild, 'call', _5 => _5({
description: typeof config === 'string' ? config : (config ).text,
op: 'db',
origin: 'auto.db.postgres',
data,
})]);
if (typeof callback === 'function') {
return orig.call(this, config, values, function (err, result) {
_optionalChain([span, 'optionalAccess', _6 => _6.end, 'call', _7 => _7()]);
callback(err, result);
});
}
if (typeof values === 'function') {
return orig.call(this, config, function (err, result) {
_optionalChain([span, 'optionalAccess', _8 => _8.end, 'call', _9 => _9()]);
values(err, result);
});
}
const rv = typeof values !== 'undefined' ? orig.call(this, config, values) : orig.call(this, config);
if (isThenable(rv)) {
return rv.then((res) => {
_optionalChain([span, 'optionalAccess', _10 => _10.end, 'call', _11 => _11()]);
return res;
});
}
_optionalChain([span, 'optionalAccess', _12 => _12.end, 'call', _13 => _13()]);
return rv;
};
});
}
}Postgres.__initStatic();
export { Postgres };
//# sourceMappingURL=postgres.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,89 @@
import { startSpan, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, getCurrentHub } from '@sentry/core';
import { addNonEnumerableProperty, logger } from '@sentry/utils';
import { DEBUG_BUILD } from '../../common/debug-build.js';
import { shouldDisableAutoInstrumentation } from './utils/node-utils.js';
function isValidPrismaClient(possibleClient) {
return !!possibleClient && !!(possibleClient )['$use'];
}
/** Tracing integration for @prisma/client package */
class Prisma {
/**
* @inheritDoc
*/
static __initStatic() {this.id = 'Prisma';}
/**
* @inheritDoc
*/
/**
* @inheritDoc
*/
constructor(options = {}) {
this.name = Prisma.id;
// We instrument the PrismaClient inside the constructor and not inside `setupOnce` because in some cases of server-side
// bundling (Next.js) multiple Prisma clients can be instantiated, even though users don't intend to. When instrumenting
// in setupOnce we can only ever instrument one client.
// https://github.com/getsentry/sentry-javascript/issues/7216#issuecomment-1602375012
// In the future we might explore providing a dedicated PrismaClient middleware instead of this hack.
if (isValidPrismaClient(options.client) && !options.client._sentryInstrumented) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
addNonEnumerableProperty(options.client , '_sentryInstrumented', true);
const clientData = {};
try {
const engineConfig = (options.client )._engineConfig;
if (engineConfig) {
const { activeProvider, clientVersion } = engineConfig;
if (activeProvider) {
clientData['db.system'] = activeProvider;
}
if (clientVersion) {
clientData['db.prisma.version'] = clientVersion;
}
}
} catch (e) {
// ignore
}
options.client.$use((params, next) => {
// eslint-disable-next-line deprecation/deprecation
if (shouldDisableAutoInstrumentation(getCurrentHub)) {
return next(params);
}
const action = params.action;
const model = params.model;
return startSpan(
{
name: model ? `${model} ${action}` : action,
onlyIfParent: true,
op: 'db.prisma',
attributes: {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.db.prisma',
},
data: { ...clientData, 'db.operation': action },
},
() => next(params),
);
});
} else {
DEBUG_BUILD &&
logger.warn('Unsupported Prisma client provided to PrismaIntegration. Provided client:', options.client);
}
}
/**
* @inheritDoc
*/
setupOnce() {
// Noop - here for backwards compatibility
}
} Prisma.__initStatic();
export { Prisma };
//# sourceMappingURL=prisma.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,19 @@
import { _optionalChain } from '@sentry/utils';
/**
* Check if Sentry auto-instrumentation should be disabled.
*
* @param getCurrentHub A method to fetch the current hub
* @returns boolean
*/
// eslint-disable-next-line deprecation/deprecation
function shouldDisableAutoInstrumentation(getCurrentHub) {
// eslint-disable-next-line deprecation/deprecation
const clientOptions = _optionalChain([getCurrentHub, 'call', _ => _(), 'access', _2 => _2.getClient, 'call', _3 => _3(), 'optionalAccess', _4 => _4.getOptions, 'call', _5 => _5()]);
const instrumenter = _optionalChain([clientOptions, 'optionalAccess', _6 => _6.instrumenter]) || 'sentry';
return instrumenter !== 'sentry';
}
export { shouldDisableAutoInstrumentation };
//# sourceMappingURL=node-utils.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node-utils.js","sources":["../../../../../src/node/integrations/utils/node-utils.ts"],"sourcesContent":["import type { Hub } from '@sentry/types';\n\n/**\n * Check if Sentry auto-instrumentation should be disabled.\n *\n * @param getCurrentHub A method to fetch the current hub\n * @returns boolean\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function shouldDisableAutoInstrumentation(getCurrentHub: () => Hub): boolean {\n // eslint-disable-next-line deprecation/deprecation\n const clientOptions = getCurrentHub().getClient()?.getOptions();\n const instrumenter = clientOptions?.instrumenter || 'sentry';\n\n return instrumenter !== 'sentry';\n}\n"],"names":[],"mappings":";;AAEA,CAAA,CAAA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;CACA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA;CACA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;CACA,CAAA;AACA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AACO,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,EAAsB;EACpF,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;EACE,CAAA,CAAA,CAAA,CAAA,EAAM,cAAgB,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,EAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,CAAA,EAAA,CAAA,EAAC,EAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAC,MAAA,EAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAC,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,oBAAE,CAAA,CAAA;EAC/D,MAAM,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,EAAA,cAAA,CAAA,CAAE,aAAa,EAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,EAAgB,QAAQ;;EAE5D,CAAO,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAiB,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ;AAClC;;"}