New:Socket for Asana Is Now Available.Learn more
Get Started

@sentry/core

Package Overview
Dependencies
Maintainers
1
Versions
727
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sentry/core - npm Package Compare versions

Comparing version
10.72.0
to
10.73.0
+12
-1
build/cjs/integrations/express/index.js

@@ -5,2 +5,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });

const exports$1 = require('../../exports.js');
const currentScopes = require('../../currentScopes.js');
const debugBuild = require('../../debug-build.js');

@@ -100,6 +101,16 @@ const utils = require('./utils.js');

}
function getIntegrationShouldHandleError() {
return currentScopes.getClient()?.getIntegrationByName("Express")?.getShouldHandleError?.();
}
function expressErrorHandler(options) {
return function sentryErrorMiddleware(error, request, res, next) {
setSdkProcessingMetadata.setSDKProcessingMetadata(request);
const shouldHandleError = options?.shouldHandleError || utils.defaultShouldHandleError;
const shouldHandleError = (
// oxlint-disable-next-line typescript/no-deprecated
options?.shouldHandleError ?? getIntegrationShouldHandleError() ?? utils.defaultShouldHandleError
);
if (shouldHandleError === false) {
next(error);
return;
}
if (shouldHandleError(error)) {

@@ -106,0 +117,0 @@ const eventId = exports$1.captureException(error, {

+1
-1

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sources":["../../../../src/integrations/express/index.ts"],"sourcesContent":["/**\n * Platform-portable Express tracing integration.\n *\n * @module\n *\n * This Sentry integration is a derivative work based on the OpenTelemetry\n * Express instrumentation.\n *\n * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>\n *\n * Extended under the terms of the Apache 2.0 license linked below:\n *\n * ----\n *\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { debug } from '../../utils/debug-logger';\nimport { captureException } from '../../exports';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type {\n ExpressApplication,\n ExpressErrorMiddleware,\n ExpressHandlerOptions,\n ExpressIntegrationOptions,\n ExpressLayer,\n ExpressMiddleware,\n ExpressModuleExport,\n ExpressRequest,\n ExpressResponse,\n ExpressRouter,\n ExpressRouterv4,\n ExpressRouterv5,\n MiddlewareError,\n} from './types';\nimport {\n defaultShouldHandleError,\n getLayerPath,\n isExpressWithoutRouterPrototype,\n isExpressWithRouterPrototype,\n} from './utils';\nimport { wrapMethod } from '../../utils/object';\nimport { patchLayer } from './patch-layer';\nimport { setSDKProcessingMetadata } from './set-sdk-processing-metadata';\nimport { getDefaultExport } from '../../utils/get-default-export';\n\nfunction isLegacyOptions(\n options: ExpressModuleExport | (ExpressIntegrationOptions & { express: ExpressModuleExport }),\n): options is ExpressIntegrationOptions & { express: ExpressModuleExport } {\n return !!(options as { express: ExpressModuleExport }).express;\n}\n\n// TODO: remove this deprecation handling in v11\nlet didLegacyDeprecationWarning = false;\nfunction deprecationWarning() {\n if (!didLegacyDeprecationWarning) {\n didLegacyDeprecationWarning = true;\n DEBUG_BUILD &&\n debug.warn(\n '[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead.',\n );\n }\n}\n\n/**\n * This is a portable instrumentatiton function that works in any environment\n * where Express can be loaded, without depending on OpenTelemetry.\n *\n * @example\n * ```javascript\n * import express from 'express';\n * import * as Sentry from '@sentry/deno'; // or any SDK that extends core\n *\n * Sentry.patchExpressModule(express, () => ({}));\n * ```\n */\nexport function patchExpressModule(\n moduleExports: ExpressModuleExport,\n getOptions: () => ExpressIntegrationOptions,\n): ExpressModuleExport;\n/**\n * @deprecated Pass the Express module export as the first argument and options getter as the second argument.\n */\nexport function patchExpressModule(\n options: ExpressIntegrationOptions & { express: ExpressModuleExport },\n): ExpressModuleExport;\nexport function patchExpressModule(\n optionsOrExports: ExpressModuleExport | (ExpressIntegrationOptions & { express: ExpressModuleExport }),\n maybeGetOptions?: () => ExpressIntegrationOptions,\n): ExpressModuleExport {\n let getOptions: () => ExpressIntegrationOptions;\n let moduleExports: ExpressModuleExport;\n if (!maybeGetOptions && isLegacyOptions(optionsOrExports)) {\n // eslint-disable-next-line typescript/no-deprecated\n const { express, ...options } = optionsOrExports;\n moduleExports = express;\n getOptions = () => options;\n deprecationWarning();\n } else if (typeof maybeGetOptions !== 'function') {\n throw new TypeError('`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback');\n } else {\n getOptions = maybeGetOptions;\n moduleExports = optionsOrExports as ExpressModuleExport;\n }\n\n // pass in the require() or import() result of express\n const express = getDefaultExport(moduleExports);\n const routerProto: ExpressRouterv4 | ExpressRouterv5 | undefined = isExpressWithRouterPrototype(express)\n ? express.Router.prototype // Express v5\n : isExpressWithoutRouterPrototype(express)\n ? express.Router // Express v4\n : undefined;\n\n if (!routerProto) {\n throw new TypeError('no valid Express route function to instrument');\n }\n\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n const originalRouteMethod = routerProto.route;\n try {\n wrapMethod(\n routerProto,\n 'route',\n function routeTrace(this: ExpressRouter, ...args: Parameters<typeof originalRouteMethod>[]) {\n const route = originalRouteMethod.apply(this, args);\n const layer = this.stack[this.stack.length - 1] as ExpressLayer;\n patchLayer(getOptions, layer, getLayerPath(args));\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express route method:', e);\n }\n\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n const originalRouterUse = routerProto.use;\n try {\n wrapMethod(\n routerProto,\n 'use',\n function useTrace(this: ExpressApplication, ...args: Parameters<typeof originalRouterUse>) {\n const route = originalRouterUse.apply(this, args);\n const layer = this.stack[this.stack.length - 1];\n if (!layer) {\n return route;\n }\n patchLayer(getOptions, layer, getLayerPath(args));\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express use method:', e);\n }\n\n const { application } = express;\n const originalApplicationUse = application.use;\n try {\n wrapMethod(\n application,\n 'use',\n function appUseTrace(\n this: ExpressApplication & {\n _router?: ExpressRouter;\n router?: ExpressRouter;\n },\n ...args: Parameters<ExpressApplication['use']>\n ) {\n // If we access app.router in express 4.x we trigger an assertion error.\n // This property existed in v3, was removed in v4 and then re-added in v5.\n const route = originalApplicationUse.apply(this, args);\n const router = isExpressWithRouterPrototype(express) ? this.router : this._router;\n if (router) {\n const layer = router.stack[router.stack.length - 1];\n if (layer) {\n patchLayer(getOptions, layer, getLayerPath(args));\n }\n }\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express application.use method:', e);\n }\n\n return express;\n}\n\n/**\n * An Express-compatible error handler, used by setupExpressErrorHandler\n */\nexport function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErrorMiddleware {\n return function sentryErrorMiddleware(\n error: MiddlewareError,\n request: ExpressRequest,\n res: ExpressResponse,\n next: (error: MiddlewareError) => void,\n ): void {\n // When an error happens, the `expressRequestHandler` middleware does not run, so we set it here too\n setSDKProcessingMetadata(request);\n const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;\n\n if (shouldHandleError(error)) {\n const eventId = captureException(error, {\n mechanism: { type: 'auto.middleware.express', handled: false },\n });\n (res as { sentry?: string }).sentry = eventId;\n }\n\n next(error);\n };\n}\n\n/**\n * Add an Express error handler to capture errors to Sentry.\n *\n * The error handler must be before any other middleware and after all controllers.\n *\n * @param app The Express instances\n * @param options {ExpressHandlerOptions} Configuration options for the handler\n *\n * @example\n * ```javascript\n * import * as Sentry from 'sentry/deno'; // or any other @sentry/<platform>\n * import * as express from 'express';\n *\n * Sentry.instrumentExpress(express);\n *\n * const app = express();\n *\n * // Add your routes, etc.\n *\n * // Add this after all routes,\n * // but before any and other error-handling middlewares are defined\n * Sentry.setupExpressErrorHandler(app);\n *\n * app.listen(3000);\n * ```\n */\nexport function setupExpressErrorHandler(\n app: {\n //oxlint-disable-next-line no-explicit-any\n use: (middleware: any) => unknown;\n },\n options?: ExpressHandlerOptions,\n): void {\n app.use(expressRequestHandler());\n app.use(expressErrorHandler(options));\n}\n\nfunction expressRequestHandler(): ExpressMiddleware {\n return function sentryRequestMiddleware(request: ExpressRequest, _res: ExpressResponse, next: () => void): void {\n setSDKProcessingMetadata(request);\n next();\n };\n}\n"],"names":["DEBUG_BUILD","debug","express","getDefaultExport","isExpressWithRouterPrototype","isExpressWithoutRouterPrototype","wrapMethod","patchLayer","getLayerPath","setSDKProcessingMetadata","defaultShouldHandleError","captureException"],"mappings":";;;;;;;;;;;AA0DA,SAAS,gBACP,OAAA,EACyE;AACzE,EAAA,OAAO,CAAC,CAAE,OAAA,CAA6C,OAAA;AACzD;AAGA,IAAI,2BAAA,GAA8B,KAAA;AAClC,SAAS,kBAAA,GAAqB;AAC5B,EAAA,IAAI,CAAC,2BAAA,EAA6B;AAChC,IAAA,2BAAA,GAA8B,IAAA;AAC9B,IAAAA,sBAAA,IACEC,iBAAA,CAAM,IAAA;AAAA,MACJ;AAAA,KACF;AAAA,EACJ;AACF;AAwBO,SAAS,kBAAA,CACd,kBACA,eAAA,EACqB;AACrB,EAAA,IAAI,UAAA;AACJ,EAAA,IAAI,aAAA;AACJ,EAAA,IAAI,CAAC,eAAA,IAAmB,eAAA,CAAgB,gBAAgB,CAAA,EAAG;AAEzD,IAAA,MAAM,EAAE,OAAA,EAAAC,QAAAA,EAAS,GAAG,SAAQ,GAAI,gBAAA;AAChC,IAAA,aAAA,GAAgBA,QAAAA;AAChB,IAAA,UAAA,GAAa,MAAM,OAAA;AACnB,IAAA,kBAAA,EAAmB;AAAA,EACrB,CAAA,MAAA,IAAW,OAAO,eAAA,KAAoB,UAAA,EAAY;AAChD,IAAA,MAAM,IAAI,UAAU,kFAAkF,CAAA;AAAA,EACxG,CAAA,MAAO;AACL,IAAA,UAAA,GAAa,eAAA;AACb,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EACA,OAAA,EACA,KACA,IAAA,EACM;AAEN,IAAAQ,iDAAA,CAAyB,OAAO,CAAA;AAChC,IAAA,MAAM,iBAAA,GAAoB,SAAS,iBAAA,IAAqBC,8BAAA;AAExD,IAAA,IAAI,iBAAA,CAAkB,KAAK,CAAA,EAAG;AAC5B,MAAA,MAAM,OAAA,GAAUC,2BAAiB,KAAA,EAAO;AAAA,QACtC,SAAA,EAAW,EAAE,IAAA,EAAM,yBAAA,EAA2B,SAAS,KAAA;AAAM,OAC9D,CAAA;AACD,MAAC,IAA4B,MAAA,GAAS,OAAA;AAAA,IACxC;AAEA,IAAA,IAAA,CAAK,KAAK,CAAA;AAAA,EACZ,CAAA;AACF;AA4BO,SAAS,wBAAA,CACd,KAIA,OAAA,EACM;AACN,EAAA,GAAA,CAAI,GAAA,CAAI,uBAAuB,CAAA;AAC/B,EAAA,GAAA,CAAI,GAAA,CAAI,mBAAA,CAAoB,OAAO,CAAC,CAAA;AACtC;AAEA,SAAS,qBAAA,GAA2C;AAClD,EAAA,OAAO,SAAS,uBAAA,CAAwB,OAAA,EAAyB,IAAA,EAAuB,IAAA,EAAwB;AAC9G,IAAAF,iDAAA,CAAyB,OAAO,CAAA;AAChC,IAAA,IAAA,EAAK;AAAA,EACP,CAAA;AACF;;;;;;"}
{"version":3,"file":"index.js","sources":["../../../../src/integrations/express/index.ts"],"sourcesContent":["/**\n * Platform-portable Express tracing integration.\n *\n * @module\n *\n * This Sentry integration is a derivative work based on the OpenTelemetry\n * Express instrumentation.\n *\n * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>\n *\n * Extended under the terms of the Apache 2.0 license linked below:\n *\n * ----\n *\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { debug } from '../../utils/debug-logger';\nimport { captureException } from '../../exports';\nimport { getClient } from '../../currentScopes';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type {\n ExpressApplication,\n ExpressErrorMiddleware,\n ExpressHandlerOptions,\n ExpressIntegration,\n ExpressIntegrationOptions,\n ExpressLayer,\n ExpressMiddleware,\n ExpressModuleExport,\n ExpressRequest,\n ExpressResponse,\n ExpressRouter,\n ExpressRouterv4,\n ExpressRouterv5,\n ExpressShouldHandleError,\n MiddlewareError,\n} from './types';\nimport {\n defaultShouldHandleError,\n getLayerPath,\n isExpressWithoutRouterPrototype,\n isExpressWithRouterPrototype,\n} from './utils';\nimport { wrapMethod } from '../../utils/object';\nimport { patchLayer } from './patch-layer';\nimport { setSDKProcessingMetadata } from './set-sdk-processing-metadata';\nimport { getDefaultExport } from '../../utils/get-default-export';\n\nfunction isLegacyOptions(\n options: ExpressModuleExport | (ExpressIntegrationOptions & { express: ExpressModuleExport }),\n): options is ExpressIntegrationOptions & { express: ExpressModuleExport } {\n return !!(options as { express: ExpressModuleExport }).express;\n}\n\n// TODO: remove this deprecation handling in v11\nlet didLegacyDeprecationWarning = false;\nfunction deprecationWarning() {\n if (!didLegacyDeprecationWarning) {\n didLegacyDeprecationWarning = true;\n DEBUG_BUILD &&\n debug.warn(\n '[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead.',\n );\n }\n}\n\n/**\n * This is a portable instrumentatiton function that works in any environment\n * where Express can be loaded, without depending on OpenTelemetry.\n *\n * @example\n * ```javascript\n * import express from 'express';\n * import * as Sentry from '@sentry/deno'; // or any SDK that extends core\n *\n * Sentry.patchExpressModule(express, () => ({}));\n * ```\n */\nexport function patchExpressModule(\n moduleExports: ExpressModuleExport,\n getOptions: () => ExpressIntegrationOptions,\n): ExpressModuleExport;\n/**\n * @deprecated Pass the Express module export as the first argument and options getter as the second argument.\n */\nexport function patchExpressModule(\n options: ExpressIntegrationOptions & { express: ExpressModuleExport },\n): ExpressModuleExport;\nexport function patchExpressModule(\n optionsOrExports: ExpressModuleExport | (ExpressIntegrationOptions & { express: ExpressModuleExport }),\n maybeGetOptions?: () => ExpressIntegrationOptions,\n): ExpressModuleExport {\n let getOptions: () => ExpressIntegrationOptions;\n let moduleExports: ExpressModuleExport;\n if (!maybeGetOptions && isLegacyOptions(optionsOrExports)) {\n // eslint-disable-next-line typescript/no-deprecated\n const { express, ...options } = optionsOrExports;\n moduleExports = express;\n getOptions = () => options;\n deprecationWarning();\n } else if (typeof maybeGetOptions !== 'function') {\n throw new TypeError('`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback');\n } else {\n getOptions = maybeGetOptions;\n moduleExports = optionsOrExports as ExpressModuleExport;\n }\n\n // pass in the require() or import() result of express\n const express = getDefaultExport(moduleExports);\n const routerProto: ExpressRouterv4 | ExpressRouterv5 | undefined = isExpressWithRouterPrototype(express)\n ? express.Router.prototype // Express v5\n : isExpressWithoutRouterPrototype(express)\n ? express.Router // Express v4\n : undefined;\n\n if (!routerProto) {\n throw new TypeError('no valid Express route function to instrument');\n }\n\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n const originalRouteMethod = routerProto.route;\n try {\n wrapMethod(\n routerProto,\n 'route',\n function routeTrace(this: ExpressRouter, ...args: Parameters<typeof originalRouteMethod>[]) {\n const route = originalRouteMethod.apply(this, args);\n const layer = this.stack[this.stack.length - 1] as ExpressLayer;\n patchLayer(getOptions, layer, getLayerPath(args));\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express route method:', e);\n }\n\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n const originalRouterUse = routerProto.use;\n try {\n wrapMethod(\n routerProto,\n 'use',\n function useTrace(this: ExpressApplication, ...args: Parameters<typeof originalRouterUse>) {\n const route = originalRouterUse.apply(this, args);\n const layer = this.stack[this.stack.length - 1];\n if (!layer) {\n return route;\n }\n patchLayer(getOptions, layer, getLayerPath(args));\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express use method:', e);\n }\n\n const { application } = express;\n const originalApplicationUse = application.use;\n try {\n wrapMethod(\n application,\n 'use',\n function appUseTrace(\n this: ExpressApplication & {\n _router?: ExpressRouter;\n router?: ExpressRouter;\n },\n ...args: Parameters<ExpressApplication['use']>\n ) {\n // If we access app.router in express 4.x we trigger an assertion error.\n // This property existed in v3, was removed in v4 and then re-added in v5.\n const route = originalApplicationUse.apply(this, args);\n const router = isExpressWithRouterPrototype(express) ? this.router : this._router;\n if (router) {\n const layer = router.stack[router.stack.length - 1];\n if (layer) {\n patchLayer(getOptions, layer, getLayerPath(args));\n }\n }\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express application.use method:', e);\n }\n\n return express;\n}\n\n/**\n * The `shouldHandleError` configured on the registered Express integration, if any.\n *\n * The integration is defined per platform (e.g. `expressIntegration()` in `@sentry/node`), so it is\n * looked up by name here — the same way `getIntegrationByName` is used for `VercelAI` and\n * `ProfilingIntegration`.\n */\nfunction getIntegrationShouldHandleError(): ExpressShouldHandleError | undefined {\n return getClient()?.getIntegrationByName<ExpressIntegration>('Express')?.getShouldHandleError?.();\n}\n\n/**\n * An Express-compatible error handler, used by setupExpressErrorHandler\n */\nexport function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErrorMiddleware {\n return function sentryErrorMiddleware(\n error: MiddlewareError,\n request: ExpressRequest,\n res: ExpressResponse,\n next: (error: MiddlewareError) => void,\n ): void {\n // When an error happens, the `expressRequestHandler` middleware does not run, so we set it here too\n setSDKProcessingMetadata(request);\n const shouldHandleError =\n // oxlint-disable-next-line typescript/no-deprecated\n options?.shouldHandleError ?? getIntegrationShouldHandleError() ?? defaultShouldHandleError;\n\n if (shouldHandleError === false) {\n next(error);\n return;\n }\n\n if (shouldHandleError(error)) {\n const eventId = captureException(error, {\n mechanism: { type: 'auto.middleware.express', handled: false },\n });\n (res as { sentry?: string }).sentry = eventId;\n }\n\n next(error);\n };\n}\n\n/**\n * Add an Express error handler to capture errors to Sentry.\n *\n * The error handler must be before any other middleware and after all controllers.\n *\n * @param app The Express instances\n * @param options {ExpressHandlerOptions} Configuration options for the handler\n *\n * @example\n * ```javascript\n * import * as Sentry from 'sentry/deno'; // or any other @sentry/<platform>\n * import * as express from 'express';\n *\n * Sentry.instrumentExpress(express);\n *\n * const app = express();\n *\n * // Add your routes, etc.\n *\n * // Add this after all routes,\n * // but before any and other error-handling middlewares are defined\n * Sentry.setupExpressErrorHandler(app);\n *\n * app.listen(3000);\n * ```\n */\nexport function setupExpressErrorHandler(\n app: {\n //oxlint-disable-next-line no-explicit-any\n use: (middleware: any) => unknown;\n },\n options?: ExpressHandlerOptions,\n): void {\n app.use(expressRequestHandler());\n app.use(expressErrorHandler(options));\n}\n\nfunction expressRequestHandler(): ExpressMiddleware {\n return function sentryRequestMiddleware(request: ExpressRequest, _res: ExpressResponse, next: () => void): void {\n setSDKProcessingMetadata(request);\n next();\n };\n}\n"],"names":["DEBUG_BUILD","debug","express","getDefaultExport","isExpressWithRouterPrototype","isExpressWithoutRouterPrototype","wrapMethod","patchLayer","getLayerPath","getClient","setSDKProcessingMetadata","defaultShouldHandleError","captureException"],"mappings":";;;;;;;;;;;;AA6DA,SAAS,gBACP,OAAA,EACyE;AACzE,EAAA,OAAO,CAAC,CAAE,OAAA,CAA6C,OAAA;AACzD;AAGA,IAAI,2BAAA,GAA8B,KAAA;AAClC,SAAS,kBAAA,GAAqB;AAC5B,EAAA,IAAI,CAAC,2BAAA,EAA6B;AAChC,IAAA,2BAAA,GAA8B,IAAA;AAC9B,IAAAA,sBAAA,IACEC,iBAAA,CAAM,IAAA;AAAA,MACJ;AAAA,KACF;AAAA,EACJ;AACF;AAwBO,SAAS,kBAAA,CACd,kBACA,eAAA,EACqB;AACrB,EAAA,IAAI,UAAA;A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,GAAA,CAAI,mBAAA,CAAoB,OAAO,CAAC,CAAA;AACtC;AAEA,SAAS,qBAAA,GAA2C;AAClD,EAAA,OAAO,SAAS,uBAAA,CAAwB,OAAA,EAAyB,IAAA,EAAuB,IAAA,EAAwB;AAC9G,IAAAF,iDAAA,CAAyB,OAAO,CAAA;AAChC,IAAA,IAAA,EAAK;AAAA,EACP,CAAA;AACF;;;;;;"}

@@ -1,1 +0,1 @@

{"version":3,"file":"types.js","sources":["../../../../src/integrations/express/types.ts"],"sourcesContent":["/**\n * Platform-portable Express tracing integration.\n *\n * @module\n *\n * This Sentry integration is a derivative work based on the OpenTelemetry\n * Express instrumentation.\n *\n * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>\n *\n * Extended under the terms of the Apache 2.0 license linked below:\n *\n * ----\n *\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RequestEventData } from '../../types/request';\nimport type { SpanAttributes } from '../../types/span';\n\nexport const ATTR_EXPRESS_NAME = 'express.name';\nexport const ATTR_HTTP_ROUTE = 'http.route';\nexport const ATTR_EXPRESS_TYPE = 'express.type';\n\nexport type ExpressExport = {\n Router: ExpressRouterv5 | ExpressRouterv4;\n application: ExpressApplication;\n};\n\nexport type ExpressExportv5 = ExpressExport & {\n Router: ExpressRouterv5;\n};\n\nexport type ExpressExportv4 = ExpressExport & {\n Router: ExpressRouterv4;\n};\n\nexport type ExpressModuleExport = ExpressExport | { default: ExpressExport };\n\nexport interface ExpressRequest extends RequestEventData {\n originalUrl: string;\n route: unknown;\n // Note: req.res is typed as optional (only present after middleware init).\n // mark optional to preserve compat with express v4 types.\n res?: ExpressResponse;\n}\n\n// just a minimum type def for what we need, since this also needs to\n// work in environments lacking node:http\nexport interface ExpressResponse {\n once(ev: string, listener: Function): this;\n removeListener(ev: string, listener?: Function): this;\n emit(ev: string, ...data: unknown[]): this;\n}\n\nexport interface NextFunction {\n (err?: unknown): void;\n /**\n * \"Break-out\" of a router by calling {next('router')};\n * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}\n */\n (deferToNext: 'router'): void;\n /**\n * \"Break-out\" of a route by calling {next('route')};\n * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application}\n */\n (deferToNext: 'route'): void;\n}\n\n// Need to mark this as `any` so they don't conflict with the actual express\n//oxlint-disable-next-line no-explicit-any\nexport type ExpressApplicationRequestHandler = (...handlers: any[]) => any;\n\nexport type ExpressRequestInfo<T = unknown> = {\n /** An express request object */\n request: T;\n route: string;\n layerType: ExpressLayerType;\n};\n\nexport type ExpressLayerType = 'router' | 'middleware' | 'request_handler';\nexport const ExpressLayerType_ROUTER = 'router';\nexport const ExpressLayerType_MIDDLEWARE = 'middleware';\nexport const ExpressLayerType_REQUEST_HANDLER = 'request_handler';\n\nexport type PathParams = string | RegExp | Array<string | RegExp>;\nexport type LayerPathSegment = string | RegExp | number;\n\nexport interface ExpressRoute {\n path: string;\n stack: ExpressLayer[];\n}\n\nexport type ExpressRouterv4 = ExpressRouter;\n\nexport interface ExpressRouterv5 {\n prototype: ExpressRouter;\n}\n\n// https://github.com/expressjs/express/blob/main/lib/router/layer.js#L33\nexport type ExpressLayer = {\n handle: Function &\n Record<string, unknown> & {\n stack?: ExpressLayer[];\n };\n name: string;\n params: { [key: string]: string };\n path?: string;\n regexp: RegExp;\n route?: ExpressLayer;\n};\n\nexport type ExpressRouter = {\n params: { [key: string]: string };\n _params: string[];\n caseSensitive: boolean;\n mergeParams: boolean;\n strict: boolean;\n stack: ExpressLayer[];\n route(prefix: PathParams): ExpressRoute;\n use(...handlers: unknown[]): unknown;\n};\n\nexport type IgnoreMatcher = string | RegExp | ((name: string) => boolean);\n\nexport type ExpressIntegrationOptions = {\n /**\n * @deprecated Pass the express module as the first argument, and an\n * options getter as the second argument to patchExpressModule.\n */\n express?: ExpressModuleExport;\n\n /** Ignore specific based on their name */\n ignoreLayers?: IgnoreMatcher[];\n /** Ignore specific layers based on their type */\n ignoreLayersType?: ExpressLayerType[];\n /**\n * Optional callback invoked each time a layer resolves the matched HTTP route.\n * Platform-specific integrations (e.g. Node.js) use this to propagate the\n * resolved route to the underlying transport layer (e.g. OTel RPCMetadata).\n */\n onRouteResolved?: (route: string | undefined) => void;\n};\n\nexport type LayerMetadata = {\n attributes: SpanAttributes;\n name: string;\n};\n\nexport interface ExpressApplication {\n stack: ExpressLayer[];\n use: ExpressApplicationRequestHandler;\n}\n\nexport interface MiddlewareError extends Error {\n status?: number | string;\n statusCode?: number | string;\n status_code?: number | string;\n output?: {\n statusCode?: number | string;\n };\n}\n\nexport type ExpressMiddleware = (req: ExpressRequest, res: ExpressResponse, next: () => void) => void;\n\nexport type ExpressErrorMiddleware = (\n error: MiddlewareError,\n req: ExpressRequest,\n res: ExpressResponse,\n next: (error: MiddlewareError) => void,\n) => void;\n\nexport interface ExpressHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * @param error Captured middleware error\n */\n shouldHandleError?(this: void, error: MiddlewareError): boolean;\n}\n"],"names":[],"mappings":";;AAgCO,MAAM,iBAAA,GAAoB;AAC1B,MAAM,eAAA,GAAkB;AACxB,MAAM,iBAAA,GAAoB;AA2D1B,MAAM,uBAAA,GAA0B;AAChC,MAAM,2BAAA,GAA8B;AACpC,MAAM,gCAAA,GAAmC;;;;;;;;;"}
{"version":3,"file":"types.js","sources":["../../../../src/integrations/express/types.ts"],"sourcesContent":["/**\n * Platform-portable Express tracing integration.\n *\n * @module\n *\n * This Sentry integration is a derivative work based on the OpenTelemetry\n * Express instrumentation.\n *\n * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>\n *\n * Extended under the terms of the Apache 2.0 license linked below:\n *\n * ----\n *\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Integration } from '../../types/integration';\nimport type { RequestEventData } from '../../types/request';\nimport type { SpanAttributes } from '../../types/span';\n\nexport const ATTR_EXPRESS_NAME = 'express.name';\nexport const ATTR_HTTP_ROUTE = 'http.route';\nexport const ATTR_EXPRESS_TYPE = 'express.type';\n\nexport type ExpressExport = {\n Router: ExpressRouterv5 | ExpressRouterv4;\n application: ExpressApplication;\n};\n\nexport type ExpressExportv5 = ExpressExport & {\n Router: ExpressRouterv5;\n};\n\nexport type ExpressExportv4 = ExpressExport & {\n Router: ExpressRouterv4;\n};\n\nexport type ExpressModuleExport = ExpressExport | { default: ExpressExport };\n\nexport interface ExpressRequest extends RequestEventData {\n originalUrl: string;\n route: unknown;\n // Note: req.res is typed as optional (only present after middleware init).\n // mark optional to preserve compat with express v4 types.\n res?: ExpressResponse;\n}\n\n// just a minimum type def for what we need, since this also needs to\n// work in environments lacking node:http\nexport interface ExpressResponse {\n once(ev: string, listener: Function): this;\n removeListener(ev: string, listener?: Function): this;\n emit(ev: string, ...data: unknown[]): this;\n}\n\nexport interface NextFunction {\n (err?: unknown): void;\n /**\n * \"Break-out\" of a router by calling {next('router')};\n * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}\n */\n (deferToNext: 'router'): void;\n /**\n * \"Break-out\" of a route by calling {next('route')};\n * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application}\n */\n (deferToNext: 'route'): void;\n}\n\n// Need to mark this as `any` so they don't conflict with the actual express\n//oxlint-disable-next-line no-explicit-any\nexport type ExpressApplicationRequestHandler = (...handlers: any[]) => any;\n\nexport type ExpressRequestInfo<T = unknown> = {\n /** An express request object */\n request: T;\n route: string;\n layerType: ExpressLayerType;\n};\n\nexport type ExpressLayerType = 'router' | 'middleware' | 'request_handler';\nexport const ExpressLayerType_ROUTER = 'router';\nexport const ExpressLayerType_MIDDLEWARE = 'middleware';\nexport const ExpressLayerType_REQUEST_HANDLER = 'request_handler';\n\nexport type PathParams = string | RegExp | Array<string | RegExp>;\nexport type LayerPathSegment = string | RegExp | number;\n\nexport interface ExpressRoute {\n path: string;\n stack: ExpressLayer[];\n}\n\nexport type ExpressRouterv4 = ExpressRouter;\n\nexport interface ExpressRouterv5 {\n prototype: ExpressRouter;\n}\n\n// https://github.com/expressjs/express/blob/main/lib/router/layer.js#L33\nexport type ExpressLayer = {\n handle: Function &\n Record<string, unknown> & {\n stack?: ExpressLayer[];\n };\n name: string;\n params: { [key: string]: string };\n path?: string;\n regexp: RegExp;\n route?: ExpressLayer;\n};\n\nexport type ExpressRouter = {\n params: { [key: string]: string };\n _params: string[];\n caseSensitive: boolean;\n mergeParams: boolean;\n strict: boolean;\n stack: ExpressLayer[];\n route(prefix: PathParams): ExpressRoute;\n use(...handlers: unknown[]): unknown;\n};\n\nexport type IgnoreMatcher = string | RegExp | ((name: string) => boolean);\n\nexport type ExpressIntegrationOptions = {\n /**\n * @deprecated Pass the express module as the first argument, and an\n * options getter as the second argument to patchExpressModule.\n */\n express?: ExpressModuleExport;\n\n /** Ignore specific based on their name */\n ignoreLayers?: IgnoreMatcher[];\n /** Ignore specific layers based on their type */\n ignoreLayersType?: ExpressLayerType[];\n /**\n * Optional callback invoked each time a layer resolves the matched HTTP route.\n * Platform-specific integrations (e.g. Node.js) use this to propagate the\n * resolved route to the underlying transport layer (e.g. OTel RPCMetadata).\n */\n onRouteResolved?: (route: string | undefined) => void;\n\n /**\n * Callback deciding whether an error passed to `next(error)` should be captured\n * and sent to Sentry.\n *\n * By default, 5xx errors (and errors without a resolvable status) are sent, while\n * 3xx and 4xx errors are not. Set to `false` to capture no errors at all.\n *\n * Capturing Express errors still requires `setupExpressErrorHandler(app)`. Passing\n * `shouldHandleError` to that call instead is deprecated: it takes precedence over\n * this option, but will be removed in v11.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.expressIntegration({\n * shouldHandleError(error) {\n * return (error.statusCode ?? 500) >= 500;\n * },\n * }),\n * ],\n * });\n * ```\n */\n shouldHandleError?: ExpressShouldHandleError;\n};\n\nexport type LayerMetadata = {\n attributes: SpanAttributes;\n name: string;\n};\n\nexport interface ExpressApplication {\n stack: ExpressLayer[];\n use: ExpressApplicationRequestHandler;\n}\n\nexport interface MiddlewareError extends Error {\n status?: number | string;\n statusCode?: number | string;\n status_code?: number | string;\n output?: {\n statusCode?: number | string;\n };\n}\n\nexport type ExpressMiddleware = (req: ExpressRequest, res: ExpressResponse, next: () => void) => void;\n\nexport type ExpressErrorMiddleware = (\n error: MiddlewareError,\n req: ExpressRequest,\n res: ExpressResponse,\n next: (error: MiddlewareError) => void,\n) => void;\n\n/** Callback deciding whether an error should be captured; `false` disables capture entirely. */\nexport type ExpressShouldHandleError = ((error: MiddlewareError) => boolean) | false;\n\n/**\n * The Express integration is defined per platform (e.g. `expressIntegration()` in `@sentry/node`), so\n * `expressErrorHandler` reads its `shouldHandleError` back off the registered instance by name.\n * `getShouldHandleError` is optional because not every platform's Express integration implements it.\n */\nexport interface ExpressIntegration extends Integration {\n getShouldHandleError?: () => ExpressShouldHandleError | undefined;\n}\n\nexport interface ExpressHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n *\n * @param error Captured middleware error\n *\n * @deprecated Configure `shouldHandleError` on `expressIntegration()` rather than here. Keep calling\n * `setupExpressErrorHandler(app)` as that is what captures the errors. This option will be removed in v11.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.expressIntegration({\n * shouldHandleError(error) {\n * return (error.statusCode ?? 500) >= 500;\n * },\n * }),\n * ],\n * });\n * ```\n */\n shouldHandleError?(this: void, error: MiddlewareError): boolean;\n}\n"],"names":[],"mappings":";;AAiCO,MAAM,iBAAA,GAAoB;AAC1B,MAAM,eAAA,GAAkB;AACxB,MAAM,iBAAA,GAAoB;AA2D1B,MAAM,uBAAA,GAA0B;AAChC,MAAM,2BAAA,GAA8B;AACpC,MAAM,gCAAA,GAAmC;;;;;;;;;"}
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const SDK_VERSION = "10.72.0" ;
const SDK_VERSION = "10.73.0" ;
exports.SDK_VERSION = SDK_VERSION;
//# sourceMappingURL=version.js.map
import { debug } from '../../utils/debug-logger.js';
import { captureException } from '../../exports.js';
import { getClient } from '../../currentScopes.js';
import { DEBUG_BUILD } from '../../debug-build.js';

@@ -97,6 +98,16 @@ import { defaultShouldHandleError, isExpressWithRouterPrototype, isExpressWithoutRouterPrototype, getLayerPath } from './utils.js';

}
function getIntegrationShouldHandleError() {
return getClient()?.getIntegrationByName("Express")?.getShouldHandleError?.();
}
function expressErrorHandler(options) {
return function sentryErrorMiddleware(error, request, res, next) {
setSDKProcessingMetadata(request);
const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;
const shouldHandleError = (
// oxlint-disable-next-line typescript/no-deprecated
options?.shouldHandleError ?? getIntegrationShouldHandleError() ?? defaultShouldHandleError
);
if (shouldHandleError === false) {
next(error);
return;
}
if (shouldHandleError(error)) {

@@ -103,0 +114,0 @@ const eventId = captureException(error, {

@@ -1,1 +0,1 @@

{"version":3,"file":"index.js","sources":["../../../../src/integrations/express/index.ts"],"sourcesContent":["/**\n * Platform-portable Express tracing integration.\n *\n * @module\n *\n * This Sentry integration is a derivative work based on the OpenTelemetry\n * Express instrumentation.\n *\n * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>\n *\n * Extended under the terms of the Apache 2.0 license linked below:\n *\n * ----\n *\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { debug } from '../../utils/debug-logger';\nimport { captureException } from '../../exports';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type {\n ExpressApplication,\n ExpressErrorMiddleware,\n ExpressHandlerOptions,\n ExpressIntegrationOptions,\n ExpressLayer,\n ExpressMiddleware,\n ExpressModuleExport,\n ExpressRequest,\n ExpressResponse,\n ExpressRouter,\n ExpressRouterv4,\n ExpressRouterv5,\n MiddlewareError,\n} from './types';\nimport {\n defaultShouldHandleError,\n getLayerPath,\n isExpressWithoutRouterPrototype,\n isExpressWithRouterPrototype,\n} from './utils';\nimport { wrapMethod } from '../../utils/object';\nimport { patchLayer } from './patch-layer';\nimport { setSDKProcessingMetadata } from './set-sdk-processing-metadata';\nimport { getDefaultExport } from '../../utils/get-default-export';\n\nfunction isLegacyOptions(\n options: ExpressModuleExport | (ExpressIntegrationOptions & { express: ExpressModuleExport }),\n): options is ExpressIntegrationOptions & { express: ExpressModuleExport } {\n return !!(options as { express: ExpressModuleExport }).express;\n}\n\n// TODO: remove this deprecation handling in v11\nlet didLegacyDeprecationWarning = false;\nfunction deprecationWarning() {\n if (!didLegacyDeprecationWarning) {\n didLegacyDeprecationWarning = true;\n DEBUG_BUILD &&\n debug.warn(\n '[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead.',\n );\n }\n}\n\n/**\n * This is a portable instrumentatiton function that works in any environment\n * where Express can be loaded, without depending on OpenTelemetry.\n *\n * @example\n * ```javascript\n * import express from 'express';\n * import * as Sentry from '@sentry/deno'; // or any SDK that extends core\n *\n * Sentry.patchExpressModule(express, () => ({}));\n * ```\n */\nexport function patchExpressModule(\n moduleExports: ExpressModuleExport,\n getOptions: () => ExpressIntegrationOptions,\n): ExpressModuleExport;\n/**\n * @deprecated Pass the Express module export as the first argument and options getter as the second argument.\n */\nexport function patchExpressModule(\n options: ExpressIntegrationOptions & { express: ExpressModuleExport },\n): ExpressModuleExport;\nexport function patchExpressModule(\n optionsOrExports: ExpressModuleExport | (ExpressIntegrationOptions & { express: ExpressModuleExport }),\n maybeGetOptions?: () => ExpressIntegrationOptions,\n): ExpressModuleExport {\n let getOptions: () => ExpressIntegrationOptions;\n let moduleExports: ExpressModuleExport;\n if (!maybeGetOptions && isLegacyOptions(optionsOrExports)) {\n // eslint-disable-next-line typescript/no-deprecated\n const { express, ...options } = optionsOrExports;\n moduleExports = express;\n getOptions = () => options;\n deprecationWarning();\n } else if (typeof maybeGetOptions !== 'function') {\n throw new TypeError('`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback');\n } else {\n getOptions = maybeGetOptions;\n moduleExports = optionsOrExports as ExpressModuleExport;\n }\n\n // pass in the require() or import() result of express\n const express = getDefaultExport(moduleExports);\n const routerProto: ExpressRouterv4 | ExpressRouterv5 | undefined = isExpressWithRouterPrototype(express)\n ? express.Router.prototype // Express v5\n : isExpressWithoutRouterPrototype(express)\n ? express.Router // Express v4\n : undefined;\n\n if (!routerProto) {\n throw new TypeError('no valid Express route function to instrument');\n }\n\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n const originalRouteMethod = routerProto.route;\n try {\n wrapMethod(\n routerProto,\n 'route',\n function routeTrace(this: ExpressRouter, ...args: Parameters<typeof originalRouteMethod>[]) {\n const route = originalRouteMethod.apply(this, args);\n const layer = this.stack[this.stack.length - 1] as ExpressLayer;\n patchLayer(getOptions, layer, getLayerPath(args));\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express route method:', e);\n }\n\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n const originalRouterUse = routerProto.use;\n try {\n wrapMethod(\n routerProto,\n 'use',\n function useTrace(this: ExpressApplication, ...args: Parameters<typeof originalRouterUse>) {\n const route = originalRouterUse.apply(this, args);\n const layer = this.stack[this.stack.length - 1];\n if (!layer) {\n return route;\n }\n patchLayer(getOptions, layer, getLayerPath(args));\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express use method:', e);\n }\n\n const { application } = express;\n const originalApplicationUse = application.use;\n try {\n wrapMethod(\n application,\n 'use',\n function appUseTrace(\n this: ExpressApplication & {\n _router?: ExpressRouter;\n router?: ExpressRouter;\n },\n ...args: Parameters<ExpressApplication['use']>\n ) {\n // If we access app.router in express 4.x we trigger an assertion error.\n // This property existed in v3, was removed in v4 and then re-added in v5.\n const route = originalApplicationUse.apply(this, args);\n const router = isExpressWithRouterPrototype(express) ? this.router : this._router;\n if (router) {\n const layer = router.stack[router.stack.length - 1];\n if (layer) {\n patchLayer(getOptions, layer, getLayerPath(args));\n }\n }\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express application.use method:', e);\n }\n\n return express;\n}\n\n/**\n * An Express-compatible error handler, used by setupExpressErrorHandler\n */\nexport function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErrorMiddleware {\n return function sentryErrorMiddleware(\n error: MiddlewareError,\n request: ExpressRequest,\n res: ExpressResponse,\n next: (error: MiddlewareError) => void,\n ): void {\n // When an error happens, the `expressRequestHandler` middleware does not run, so we set it here too\n setSDKProcessingMetadata(request);\n const shouldHandleError = options?.shouldHandleError || defaultShouldHandleError;\n\n if (shouldHandleError(error)) {\n const eventId = captureException(error, {\n mechanism: { type: 'auto.middleware.express', handled: false },\n });\n (res as { sentry?: string }).sentry = eventId;\n }\n\n next(error);\n };\n}\n\n/**\n * Add an Express error handler to capture errors to Sentry.\n *\n * The error handler must be before any other middleware and after all controllers.\n *\n * @param app The Express instances\n * @param options {ExpressHandlerOptions} Configuration options for the handler\n *\n * @example\n * ```javascript\n * import * as Sentry from 'sentry/deno'; // or any other @sentry/<platform>\n * import * as express from 'express';\n *\n * Sentry.instrumentExpress(express);\n *\n * const app = express();\n *\n * // Add your routes, etc.\n *\n * // Add this after all routes,\n * // but before any and other error-handling middlewares are defined\n * Sentry.setupExpressErrorHandler(app);\n *\n * app.listen(3000);\n * ```\n */\nexport function setupExpressErrorHandler(\n app: {\n //oxlint-disable-next-line no-explicit-any\n use: (middleware: any) => unknown;\n },\n options?: ExpressHandlerOptions,\n): void {\n app.use(expressRequestHandler());\n app.use(expressErrorHandler(options));\n}\n\nfunction expressRequestHandler(): ExpressMiddleware {\n return function sentryRequestMiddleware(request: ExpressRequest, _res: ExpressResponse, next: () => void): void {\n setSDKProcessingMetadata(request);\n next();\n };\n}\n"],"names":["express"],"mappings":";;;;;;;;;AA0DA,SAAS,gBACP,OAAA,EACyE;AACzE,EAAA,OAAO,CAAC,CAAE,OAAA,CAA6C,OAAA;AACzD;AAGA,IAAI,2BAAA,GAA8B,KAAA;AAClC,SAAS,kBAAA,GAAqB;AAC5B,EAAA,IAAI,CAAC,2BAAA,EAA6B;AAChC,IAAA,2BAAA,GAA8B,IAAA;AAC9B,IAAA,WAAA,IACE,KAAA,CAAM,IAAA;AAAA,MACJ;AAAA,KACF;AAAA,EACJ;AACF;AAwBO,SAAS,kBAAA,CACd,kBACA,eAAA,EACqB;AACrB,EAAA,IAAI,UAAA;AACJ,EAAA,IAAI,aAAA;AACJ,EAAA,IAAI,CAAC,eAAA,IAAmB,eAAA,CAAgB,gBAAgB,CAAA,EAAG;AAEzD,IAAA,MAAM,EAAE,OAAA,EAAAA,QAAAA,EAAS,GAAG,SAAQ,GAAI,gBAAA;AAChC,IAAA,aAAA,GAAgBA,QAAAA;AAChB,IAAA,UAAA,GAAa,MAAM,OAAA;AACnB,IAAA,kBAAA,EAAmB;AAAA,EACrB,CAAA,MAAA,IAAW,OAAO,eAAA,K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ACT;AAKO,SAAS,oBAAoB,OAAA,EAAyD;AAC3F,EAAA,OAAO,SAAS,qBAAA,CACd,KAAA,EACA,OAAA,EACA,KACA,IAAA,EACM;AAEN,IAAA,wBAAA,CAAyB,OAAO,CAAA;AAChC,IAAA,MAAM,iBAAA,GAAoB,SAAS,iBAAA,IAAqB,wBAAA;AAExD,IAAA,IAAI,iBAAA,CAAkB,KAAK,CAAA,EAAG;AAC5B,MAAA,MAAM,OAAA,GAAU,iBAAiB,KAAA,EAAO;AAAA,QACtC,SAAA,EAAW,EAAE,IAAA,EAAM,yBAAA,EAA2B,SAAS,KAAA;AAAM,OAC9D,CAAA;AACD,MAAC,IAA4B,MAAA,GAAS,OAAA;AAAA,IACxC;AAEA,IAAA,IAAA,CAAK,KAAK,CAAA;AAAA,EACZ,CAAA;AACF;AA4BO,SAAS,wBAAA,CACd,KAIA,OAAA,EACM;AACN,EAAA,GAAA,CAAI,GAAA,CAAI,uBAAuB,CAAA;AAC/B,EAAA,GAAA,CAAI,GAAA,CAAI,mBAAA,CAAoB,OAAO,CAAC,CAAA;AACtC;AAEA,SAAS,qBAAA,GAA2C;AAClD,EAAA,OAAO,SAAS,uBAAA,CAAwB,OAAA,EAAyB,IAAA,EAAuB,IAAA,EAAwB;AAC9G,IAAA,wBAAA,CAAyB,OAAO,CAAA;AAChC,IAAA,IAAA,EAAK;AAAA,EACP,CAAA;AACF;;;;"}
{"version":3,"file":"index.js","sources":["../../../../src/integrations/express/index.ts"],"sourcesContent":["/**\n * Platform-portable Express tracing integration.\n *\n * @module\n *\n * This Sentry integration is a derivative work based on the OpenTelemetry\n * Express instrumentation.\n *\n * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>\n *\n * Extended under the terms of the Apache 2.0 license linked below:\n *\n * ----\n *\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { debug } from '../../utils/debug-logger';\nimport { captureException } from '../../exports';\nimport { getClient } from '../../currentScopes';\nimport { DEBUG_BUILD } from '../../debug-build';\nimport type {\n ExpressApplication,\n ExpressErrorMiddleware,\n ExpressHandlerOptions,\n ExpressIntegration,\n ExpressIntegrationOptions,\n ExpressLayer,\n ExpressMiddleware,\n ExpressModuleExport,\n ExpressRequest,\n ExpressResponse,\n ExpressRouter,\n ExpressRouterv4,\n ExpressRouterv5,\n ExpressShouldHandleError,\n MiddlewareError,\n} from './types';\nimport {\n defaultShouldHandleError,\n getLayerPath,\n isExpressWithoutRouterPrototype,\n isExpressWithRouterPrototype,\n} from './utils';\nimport { wrapMethod } from '../../utils/object';\nimport { patchLayer } from './patch-layer';\nimport { setSDKProcessingMetadata } from './set-sdk-processing-metadata';\nimport { getDefaultExport } from '../../utils/get-default-export';\n\nfunction isLegacyOptions(\n options: ExpressModuleExport | (ExpressIntegrationOptions & { express: ExpressModuleExport }),\n): options is ExpressIntegrationOptions & { express: ExpressModuleExport } {\n return !!(options as { express: ExpressModuleExport }).express;\n}\n\n// TODO: remove this deprecation handling in v11\nlet didLegacyDeprecationWarning = false;\nfunction deprecationWarning() {\n if (!didLegacyDeprecationWarning) {\n didLegacyDeprecationWarning = true;\n DEBUG_BUILD &&\n debug.warn(\n '[Express] `patchExpressModule(options)` is deprecated. Use `patchExpressModule(moduleExports, getOptions)` instead.',\n );\n }\n}\n\n/**\n * This is a portable instrumentatiton function that works in any environment\n * where Express can be loaded, without depending on OpenTelemetry.\n *\n * @example\n * ```javascript\n * import express from 'express';\n * import * as Sentry from '@sentry/deno'; // or any SDK that extends core\n *\n * Sentry.patchExpressModule(express, () => ({}));\n * ```\n */\nexport function patchExpressModule(\n moduleExports: ExpressModuleExport,\n getOptions: () => ExpressIntegrationOptions,\n): ExpressModuleExport;\n/**\n * @deprecated Pass the Express module export as the first argument and options getter as the second argument.\n */\nexport function patchExpressModule(\n options: ExpressIntegrationOptions & { express: ExpressModuleExport },\n): ExpressModuleExport;\nexport function patchExpressModule(\n optionsOrExports: ExpressModuleExport | (ExpressIntegrationOptions & { express: ExpressModuleExport }),\n maybeGetOptions?: () => ExpressIntegrationOptions,\n): ExpressModuleExport {\n let getOptions: () => ExpressIntegrationOptions;\n let moduleExports: ExpressModuleExport;\n if (!maybeGetOptions && isLegacyOptions(optionsOrExports)) {\n // eslint-disable-next-line typescript/no-deprecated\n const { express, ...options } = optionsOrExports;\n moduleExports = express;\n getOptions = () => options;\n deprecationWarning();\n } else if (typeof maybeGetOptions !== 'function') {\n throw new TypeError('`patchExpressModule(moduleExports, getOptions)` requires a `getOptions` callback');\n } else {\n getOptions = maybeGetOptions;\n moduleExports = optionsOrExports as ExpressModuleExport;\n }\n\n // pass in the require() or import() result of express\n const express = getDefaultExport(moduleExports);\n const routerProto: ExpressRouterv4 | ExpressRouterv5 | undefined = isExpressWithRouterPrototype(express)\n ? express.Router.prototype // Express v5\n : isExpressWithoutRouterPrototype(express)\n ? express.Router // Express v4\n : undefined;\n\n if (!routerProto) {\n throw new TypeError('no valid Express route function to instrument');\n }\n\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n const originalRouteMethod = routerProto.route;\n try {\n wrapMethod(\n routerProto,\n 'route',\n function routeTrace(this: ExpressRouter, ...args: Parameters<typeof originalRouteMethod>[]) {\n const route = originalRouteMethod.apply(this, args);\n const layer = this.stack[this.stack.length - 1] as ExpressLayer;\n patchLayer(getOptions, layer, getLayerPath(args));\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express route method:', e);\n }\n\n // oxlint-disable-next-line @typescript-eslint/unbound-method\n const originalRouterUse = routerProto.use;\n try {\n wrapMethod(\n routerProto,\n 'use',\n function useTrace(this: ExpressApplication, ...args: Parameters<typeof originalRouterUse>) {\n const route = originalRouterUse.apply(this, args);\n const layer = this.stack[this.stack.length - 1];\n if (!layer) {\n return route;\n }\n patchLayer(getOptions, layer, getLayerPath(args));\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express use method:', e);\n }\n\n const { application } = express;\n const originalApplicationUse = application.use;\n try {\n wrapMethod(\n application,\n 'use',\n function appUseTrace(\n this: ExpressApplication & {\n _router?: ExpressRouter;\n router?: ExpressRouter;\n },\n ...args: Parameters<ExpressApplication['use']>\n ) {\n // If we access app.router in express 4.x we trigger an assertion error.\n // This property existed in v3, was removed in v4 and then re-added in v5.\n const route = originalApplicationUse.apply(this, args);\n const router = isExpressWithRouterPrototype(express) ? this.router : this._router;\n if (router) {\n const layer = router.stack[router.stack.length - 1];\n if (layer) {\n patchLayer(getOptions, layer, getLayerPath(args));\n }\n }\n return route;\n },\n );\n } catch (e) {\n DEBUG_BUILD && debug.error('Failed to patch express application.use method:', e);\n }\n\n return express;\n}\n\n/**\n * The `shouldHandleError` configured on the registered Express integration, if any.\n *\n * The integration is defined per platform (e.g. `expressIntegration()` in `@sentry/node`), so it is\n * looked up by name here — the same way `getIntegrationByName` is used for `VercelAI` and\n * `ProfilingIntegration`.\n */\nfunction getIntegrationShouldHandleError(): ExpressShouldHandleError | undefined {\n return getClient()?.getIntegrationByName<ExpressIntegration>('Express')?.getShouldHandleError?.();\n}\n\n/**\n * An Express-compatible error handler, used by setupExpressErrorHandler\n */\nexport function expressErrorHandler(options?: ExpressHandlerOptions): ExpressErrorMiddleware {\n return function sentryErrorMiddleware(\n error: MiddlewareError,\n request: ExpressRequest,\n res: ExpressResponse,\n next: (error: MiddlewareError) => void,\n ): void {\n // When an error happens, the `expressRequestHandler` middleware does not run, so we set it here too\n setSDKProcessingMetadata(request);\n const shouldHandleError =\n // oxlint-disable-next-line typescript/no-deprecated\n options?.shouldHandleError ?? getIntegrationShouldHandleError() ?? defaultShouldHandleError;\n\n if (shouldHandleError === false) {\n next(error);\n return;\n }\n\n if (shouldHandleError(error)) {\n const eventId = captureException(error, {\n mechanism: { type: 'auto.middleware.express', handled: false },\n });\n (res as { sentry?: string }).sentry = eventId;\n }\n\n next(error);\n };\n}\n\n/**\n * Add an Express error handler to capture errors to Sentry.\n *\n * The error handler must be before any other middleware and after all controllers.\n *\n * @param app The Express instances\n * @param options {ExpressHandlerOptions} Configuration options for the handler\n *\n * @example\n * ```javascript\n * import * as Sentry from 'sentry/deno'; // or any other @sentry/<platform>\n * import * as express from 'express';\n *\n * Sentry.instrumentExpress(express);\n *\n * const app = express();\n *\n * // Add your routes, etc.\n *\n * // Add this after all routes,\n * // but before any and other error-handling middlewares are defined\n * Sentry.setupExpressErrorHandler(app);\n *\n * app.listen(3000);\n * ```\n */\nexport function setupExpressErrorHandler(\n app: {\n //oxlint-disable-next-line no-explicit-any\n use: (middleware: any) => unknown;\n },\n options?: ExpressHandlerOptions,\n): void {\n app.use(expressRequestHandler());\n app.use(expressErrorHandler(options));\n}\n\nfunction expressRequestHandler(): ExpressMiddleware {\n return function sentryRequestMiddleware(request: ExpressRequest, _res: ExpressResponse, next: () => void): void {\n setSDKProcessingMetadata(request);\n next();\n };\n}\n"],"names":["express"],"mappings":";;;;;;;;;;AA6DA,SAAS,gBACP,OAAA,EACyE;AACzE,EAAA,OAAO,CAAC,CAAE,OAAA,CAA6C,OAAA;AACzD;AAGA,IAAI,2BAAA,GAA8B,KAAA;AAClC,SAAS,kBAAA,GAAqB;AAC5B,EAAA,IAAI,CAAC,2BAAA,EAA6B;AAChC,IAAA,2BAAA,GAA8B,IAAA;AAC9B,IAAA,WAAA,IACE,KAAA,CAAM,IAAA;AAAA,MACJ;AAAA,KACF;AAAA,EACJ;AACF;AAwBO,SAAS,kBAAA,CACd,kBACA,eAAA,EACqB;AACrB,EAAA,IAAI,UAAA;AACJ,EAAA,IAAI,aAAA;AACJ,EAAA,IAAI,CAAC,eAAA,IAAmB,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A,CAAwB,OAAA,EAAyB,IAAA,EAAuB,IAAA,EAAwB;AAC9G,IAAA,wBAAA,CAAyB,OAAO,CAAA;AAChC,IAAA,IAAA,EAAK;AAAA,EACP,CAAA;AACF;;;;"}

@@ -1,1 +0,1 @@

{"version":3,"file":"types.js","sources":["../../../../src/integrations/express/types.ts"],"sourcesContent":["/**\n * Platform-portable Express tracing integration.\n *\n * @module\n *\n * This Sentry integration is a derivative work based on the OpenTelemetry\n * Express instrumentation.\n *\n * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>\n *\n * Extended under the terms of the Apache 2.0 license linked below:\n *\n * ----\n *\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RequestEventData } from '../../types/request';\nimport type { SpanAttributes } from '../../types/span';\n\nexport const ATTR_EXPRESS_NAME = 'express.name';\nexport const ATTR_HTTP_ROUTE = 'http.route';\nexport const ATTR_EXPRESS_TYPE = 'express.type';\n\nexport type ExpressExport = {\n Router: ExpressRouterv5 | ExpressRouterv4;\n application: ExpressApplication;\n};\n\nexport type ExpressExportv5 = ExpressExport & {\n Router: ExpressRouterv5;\n};\n\nexport type ExpressExportv4 = ExpressExport & {\n Router: ExpressRouterv4;\n};\n\nexport type ExpressModuleExport = ExpressExport | { default: ExpressExport };\n\nexport interface ExpressRequest extends RequestEventData {\n originalUrl: string;\n route: unknown;\n // Note: req.res is typed as optional (only present after middleware init).\n // mark optional to preserve compat with express v4 types.\n res?: ExpressResponse;\n}\n\n// just a minimum type def for what we need, since this also needs to\n// work in environments lacking node:http\nexport interface ExpressResponse {\n once(ev: string, listener: Function): this;\n removeListener(ev: string, listener?: Function): this;\n emit(ev: string, ...data: unknown[]): this;\n}\n\nexport interface NextFunction {\n (err?: unknown): void;\n /**\n * \"Break-out\" of a router by calling {next('router')};\n * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}\n */\n (deferToNext: 'router'): void;\n /**\n * \"Break-out\" of a route by calling {next('route')};\n * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application}\n */\n (deferToNext: 'route'): void;\n}\n\n// Need to mark this as `any` so they don't conflict with the actual express\n//oxlint-disable-next-line no-explicit-any\nexport type ExpressApplicationRequestHandler = (...handlers: any[]) => any;\n\nexport type ExpressRequestInfo<T = unknown> = {\n /** An express request object */\n request: T;\n route: string;\n layerType: ExpressLayerType;\n};\n\nexport type ExpressLayerType = 'router' | 'middleware' | 'request_handler';\nexport const ExpressLayerType_ROUTER = 'router';\nexport const ExpressLayerType_MIDDLEWARE = 'middleware';\nexport const ExpressLayerType_REQUEST_HANDLER = 'request_handler';\n\nexport type PathParams = string | RegExp | Array<string | RegExp>;\nexport type LayerPathSegment = string | RegExp | number;\n\nexport interface ExpressRoute {\n path: string;\n stack: ExpressLayer[];\n}\n\nexport type ExpressRouterv4 = ExpressRouter;\n\nexport interface ExpressRouterv5 {\n prototype: ExpressRouter;\n}\n\n// https://github.com/expressjs/express/blob/main/lib/router/layer.js#L33\nexport type ExpressLayer = {\n handle: Function &\n Record<string, unknown> & {\n stack?: ExpressLayer[];\n };\n name: string;\n params: { [key: string]: string };\n path?: string;\n regexp: RegExp;\n route?: ExpressLayer;\n};\n\nexport type ExpressRouter = {\n params: { [key: string]: string };\n _params: string[];\n caseSensitive: boolean;\n mergeParams: boolean;\n strict: boolean;\n stack: ExpressLayer[];\n route(prefix: PathParams): ExpressRoute;\n use(...handlers: unknown[]): unknown;\n};\n\nexport type IgnoreMatcher = string | RegExp | ((name: string) => boolean);\n\nexport type ExpressIntegrationOptions = {\n /**\n * @deprecated Pass the express module as the first argument, and an\n * options getter as the second argument to patchExpressModule.\n */\n express?: ExpressModuleExport;\n\n /** Ignore specific based on their name */\n ignoreLayers?: IgnoreMatcher[];\n /** Ignore specific layers based on their type */\n ignoreLayersType?: ExpressLayerType[];\n /**\n * Optional callback invoked each time a layer resolves the matched HTTP route.\n * Platform-specific integrations (e.g. Node.js) use this to propagate the\n * resolved route to the underlying transport layer (e.g. OTel RPCMetadata).\n */\n onRouteResolved?: (route: string | undefined) => void;\n};\n\nexport type LayerMetadata = {\n attributes: SpanAttributes;\n name: string;\n};\n\nexport interface ExpressApplication {\n stack: ExpressLayer[];\n use: ExpressApplicationRequestHandler;\n}\n\nexport interface MiddlewareError extends Error {\n status?: number | string;\n statusCode?: number | string;\n status_code?: number | string;\n output?: {\n statusCode?: number | string;\n };\n}\n\nexport type ExpressMiddleware = (req: ExpressRequest, res: ExpressResponse, next: () => void) => void;\n\nexport type ExpressErrorMiddleware = (\n error: MiddlewareError,\n req: ExpressRequest,\n res: ExpressResponse,\n next: (error: MiddlewareError) => void,\n) => void;\n\nexport interface ExpressHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n * @param error Captured middleware error\n */\n shouldHandleError?(this: void, error: MiddlewareError): boolean;\n}\n"],"names":[],"mappings":"AAgCO,MAAM,iBAAA,GAAoB;AAC1B,MAAM,eAAA,GAAkB;AACxB,MAAM,iBAAA,GAAoB;AA2D1B,MAAM,uBAAA,GAA0B;AAChC,MAAM,2BAAA,GAA8B;AACpC,MAAM,gCAAA,GAAmC;;;;"}
{"version":3,"file":"types.js","sources":["../../../../src/integrations/express/types.ts"],"sourcesContent":["/**\n * Platform-portable Express tracing integration.\n *\n * @module\n *\n * This Sentry integration is a derivative work based on the OpenTelemetry\n * Express instrumentation.\n *\n * <https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/instrumentation-express>\n *\n * Extended under the terms of the Apache 2.0 license linked below:\n *\n * ----\n *\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Integration } from '../../types/integration';\nimport type { RequestEventData } from '../../types/request';\nimport type { SpanAttributes } from '../../types/span';\n\nexport const ATTR_EXPRESS_NAME = 'express.name';\nexport const ATTR_HTTP_ROUTE = 'http.route';\nexport const ATTR_EXPRESS_TYPE = 'express.type';\n\nexport type ExpressExport = {\n Router: ExpressRouterv5 | ExpressRouterv4;\n application: ExpressApplication;\n};\n\nexport type ExpressExportv5 = ExpressExport & {\n Router: ExpressRouterv5;\n};\n\nexport type ExpressExportv4 = ExpressExport & {\n Router: ExpressRouterv4;\n};\n\nexport type ExpressModuleExport = ExpressExport | { default: ExpressExport };\n\nexport interface ExpressRequest extends RequestEventData {\n originalUrl: string;\n route: unknown;\n // Note: req.res is typed as optional (only present after middleware init).\n // mark optional to preserve compat with express v4 types.\n res?: ExpressResponse;\n}\n\n// just a minimum type def for what we need, since this also needs to\n// work in environments lacking node:http\nexport interface ExpressResponse {\n once(ev: string, listener: Function): this;\n removeListener(ev: string, listener?: Function): this;\n emit(ev: string, ...data: unknown[]): this;\n}\n\nexport interface NextFunction {\n (err?: unknown): void;\n /**\n * \"Break-out\" of a router by calling {next('router')};\n * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.router}\n */\n (deferToNext: 'router'): void;\n /**\n * \"Break-out\" of a route by calling {next('route')};\n * @see {https://expressjs.com/en/guide/using-middleware.html#middleware.application}\n */\n (deferToNext: 'route'): void;\n}\n\n// Need to mark this as `any` so they don't conflict with the actual express\n//oxlint-disable-next-line no-explicit-any\nexport type ExpressApplicationRequestHandler = (...handlers: any[]) => any;\n\nexport type ExpressRequestInfo<T = unknown> = {\n /** An express request object */\n request: T;\n route: string;\n layerType: ExpressLayerType;\n};\n\nexport type ExpressLayerType = 'router' | 'middleware' | 'request_handler';\nexport const ExpressLayerType_ROUTER = 'router';\nexport const ExpressLayerType_MIDDLEWARE = 'middleware';\nexport const ExpressLayerType_REQUEST_HANDLER = 'request_handler';\n\nexport type PathParams = string | RegExp | Array<string | RegExp>;\nexport type LayerPathSegment = string | RegExp | number;\n\nexport interface ExpressRoute {\n path: string;\n stack: ExpressLayer[];\n}\n\nexport type ExpressRouterv4 = ExpressRouter;\n\nexport interface ExpressRouterv5 {\n prototype: ExpressRouter;\n}\n\n// https://github.com/expressjs/express/blob/main/lib/router/layer.js#L33\nexport type ExpressLayer = {\n handle: Function &\n Record<string, unknown> & {\n stack?: ExpressLayer[];\n };\n name: string;\n params: { [key: string]: string };\n path?: string;\n regexp: RegExp;\n route?: ExpressLayer;\n};\n\nexport type ExpressRouter = {\n params: { [key: string]: string };\n _params: string[];\n caseSensitive: boolean;\n mergeParams: boolean;\n strict: boolean;\n stack: ExpressLayer[];\n route(prefix: PathParams): ExpressRoute;\n use(...handlers: unknown[]): unknown;\n};\n\nexport type IgnoreMatcher = string | RegExp | ((name: string) => boolean);\n\nexport type ExpressIntegrationOptions = {\n /**\n * @deprecated Pass the express module as the first argument, and an\n * options getter as the second argument to patchExpressModule.\n */\n express?: ExpressModuleExport;\n\n /** Ignore specific based on their name */\n ignoreLayers?: IgnoreMatcher[];\n /** Ignore specific layers based on their type */\n ignoreLayersType?: ExpressLayerType[];\n /**\n * Optional callback invoked each time a layer resolves the matched HTTP route.\n * Platform-specific integrations (e.g. Node.js) use this to propagate the\n * resolved route to the underlying transport layer (e.g. OTel RPCMetadata).\n */\n onRouteResolved?: (route: string | undefined) => void;\n\n /**\n * Callback deciding whether an error passed to `next(error)` should be captured\n * and sent to Sentry.\n *\n * By default, 5xx errors (and errors without a resolvable status) are sent, while\n * 3xx and 4xx errors are not. Set to `false` to capture no errors at all.\n *\n * Capturing Express errors still requires `setupExpressErrorHandler(app)`. Passing\n * `shouldHandleError` to that call instead is deprecated: it takes precedence over\n * this option, but will be removed in v11.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.expressIntegration({\n * shouldHandleError(error) {\n * return (error.statusCode ?? 500) >= 500;\n * },\n * }),\n * ],\n * });\n * ```\n */\n shouldHandleError?: ExpressShouldHandleError;\n};\n\nexport type LayerMetadata = {\n attributes: SpanAttributes;\n name: string;\n};\n\nexport interface ExpressApplication {\n stack: ExpressLayer[];\n use: ExpressApplicationRequestHandler;\n}\n\nexport interface MiddlewareError extends Error {\n status?: number | string;\n statusCode?: number | string;\n status_code?: number | string;\n output?: {\n statusCode?: number | string;\n };\n}\n\nexport type ExpressMiddleware = (req: ExpressRequest, res: ExpressResponse, next: () => void) => void;\n\nexport type ExpressErrorMiddleware = (\n error: MiddlewareError,\n req: ExpressRequest,\n res: ExpressResponse,\n next: (error: MiddlewareError) => void,\n) => void;\n\n/** Callback deciding whether an error should be captured; `false` disables capture entirely. */\nexport type ExpressShouldHandleError = ((error: MiddlewareError) => boolean) | false;\n\n/**\n * The Express integration is defined per platform (e.g. `expressIntegration()` in `@sentry/node`), so\n * `expressErrorHandler` reads its `shouldHandleError` back off the registered instance by name.\n * `getShouldHandleError` is optional because not every platform's Express integration implements it.\n */\nexport interface ExpressIntegration extends Integration {\n getShouldHandleError?: () => ExpressShouldHandleError | undefined;\n}\n\nexport interface ExpressHandlerOptions {\n /**\n * Callback method deciding whether error should be captured and sent to Sentry\n *\n * @param error Captured middleware error\n *\n * @deprecated Configure `shouldHandleError` on `expressIntegration()` rather than here. Keep calling\n * `setupExpressErrorHandler(app)` as that is what captures the errors. This option will be removed in v11.\n *\n * @example\n *\n * ```javascript\n * Sentry.init({\n * integrations: [\n * Sentry.expressIntegration({\n * shouldHandleError(error) {\n * return (error.statusCode ?? 500) >= 500;\n * },\n * }),\n * ],\n * });\n * ```\n */\n shouldHandleError?(this: void, error: MiddlewareError): boolean;\n}\n"],"names":[],"mappings":"AAiCO,MAAM,iBAAA,GAAoB;AAC1B,MAAM,eAAA,GAAkB;AACxB,MAAM,iBAAA,GAAoB;AA2D1B,MAAM,uBAAA,GAA0B;AAChC,MAAM,2BAAA,GAA8B;AACpC,MAAM,gCAAA,GAAmC;;;;"}

@@ -1,1 +0,1 @@

{"type":"module","version":"10.72.0","sideEffects":false}
{"type":"module","version":"10.73.0","sideEffects":false}

@@ -1,4 +0,4 @@

const SDK_VERSION = "10.72.0" ;
const SDK_VERSION = "10.73.0" ;
export { SDK_VERSION };
//# sourceMappingURL=version.js.map

@@ -29,2 +29,3 @@ /**

*/
import { Integration } from '../../types/integration';
import { RequestEventData } from '../../types/request';

@@ -133,2 +134,28 @@ import { SpanAttributes } from '../../types/span';

onRouteResolved?: (route: string | undefined) => void;
/**
* Callback deciding whether an error passed to `next(error)` should be captured
* and sent to Sentry.
*
* By default, 5xx errors (and errors without a resolvable status) are sent, while
* 3xx and 4xx errors are not. Set to `false` to capture no errors at all.
*
* Capturing Express errors still requires `setupExpressErrorHandler(app)`. Passing
* `shouldHandleError` to that call instead is deprecated: it takes precedence over
* this option, but will be removed in v11.
*
* @example
*
* ```javascript
* Sentry.init({
* integrations: [
* Sentry.expressIntegration({
* shouldHandleError(error) {
* return (error.statusCode ?? 500) >= 500;
* },
* }),
* ],
* });
* ```
*/
shouldHandleError?: ExpressShouldHandleError;
};

@@ -153,6 +180,34 @@ export type LayerMetadata = {

export type ExpressErrorMiddleware = (error: MiddlewareError, req: ExpressRequest, res: ExpressResponse, next: (error: MiddlewareError) => void) => void;
/** Callback deciding whether an error should be captured; `false` disables capture entirely. */
export type ExpressShouldHandleError = ((error: MiddlewareError) => boolean) | false;
/**
* The Express integration is defined per platform (e.g. `expressIntegration()` in `@sentry/node`), so
* `expressErrorHandler` reads its `shouldHandleError` back off the registered instance by name.
* `getShouldHandleError` is optional because not every platform's Express integration implements it.
*/
export interface ExpressIntegration extends Integration {
getShouldHandleError?: () => ExpressShouldHandleError | undefined;
}
export interface ExpressHandlerOptions {
/**
* Callback method deciding whether error should be captured and sent to Sentry
*
* @param error Captured middleware error
*
* @deprecated Configure `shouldHandleError` on `expressIntegration()` rather than here. Keep calling
* `setupExpressErrorHandler(app)` as that is what captures the errors. This option will be removed in v11.
*
* @example
*
* ```javascript
* Sentry.init({
* integrations: [
* Sentry.expressIntegration({
* shouldHandleError(error) {
* return (error.statusCode ?? 500) >= 500;
* },
* }),
* ],
* });
* ```
*/

@@ -159,0 +214,0 @@ shouldHandleError?(this: void, error: MiddlewareError): boolean;

@@ -13,3 +13,3 @@ export { ServerRuntimeClientOptions } from './server-runtime-client';

export { patchExpressModule, setupExpressErrorHandler, expressErrorHandler } from './integrations/express/index';
export { ExpressIntegrationOptions, ExpressHandlerOptions, ExpressMiddleware, ExpressErrorMiddleware, } from './integrations/express/types';
export { ExpressIntegration, ExpressIntegrationOptions, ExpressHandlerOptions, ExpressMiddleware, ExpressErrorMiddleware, ExpressShouldHandleError, } from './integrations/express/types';
export { instrumentPostgresJsSql, _sanitizeSqlQuery as _INTERNAL_sanitizeSqlQuery, _reconstructQuery as _INTERNAL_reconstructPostgresQuery, _buildConnectionContext as _INTERNAL_buildPostgresConnectionContext, _setConnectionAttributes as _INTERNAL_setPostgresConnectionAttributes, _setOperationName as _INTERNAL_setPostgresOperationName, } from './integrations/postgresjs';

@@ -16,0 +16,0 @@ export { PostgresConnectionContext } from './integrations/postgresjs';

@@ -1,1 +0,1 @@

{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/express/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAKH,OAAO,KAAK,EAEV,sBAAsB,EACtB,qBAAqB,EACrB,yBAAyB,EAGzB,mBAAmB,EAOpB,MAAM,SAAS,CAAC;AA8BjB;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,mBAAmB,EA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"}

@@ -29,2 +29,3 @@ /**

*/
import type { Integration } from '../../types/integration';
import type { RequestEventData } from '../../types/request';

@@ -133,2 +134,28 @@ import type { SpanAttributes } from '../../types/span';

onRouteResolved?: (route: string | undefined) => void;
/**
* Callback deciding whether an error passed to `next(error)` should be captured
* and sent to Sentry.
*
* By default, 5xx errors (and errors without a resolvable status) are sent, while
* 3xx and 4xx errors are not. Set to `false` to capture no errors at all.
*
* Capturing Express errors still requires `setupExpressErrorHandler(app)`. Passing
* `shouldHandleError` to that call instead is deprecated: it takes precedence over
* this option, but will be removed in v11.
*
* @example
*
* ```javascript
* Sentry.init({
* integrations: [
* Sentry.expressIntegration({
* shouldHandleError(error) {
* return (error.statusCode ?? 500) >= 500;
* },
* }),
* ],
* });
* ```
*/
shouldHandleError?: ExpressShouldHandleError;
};

@@ -153,6 +180,34 @@ export type LayerMetadata = {

export type ExpressErrorMiddleware = (error: MiddlewareError, req: ExpressRequest, res: ExpressResponse, next: (error: MiddlewareError) => void) => void;
/** Callback deciding whether an error should be captured; `false` disables capture entirely. */
export type ExpressShouldHandleError = ((error: MiddlewareError) => boolean) | false;
/**
* The Express integration is defined per platform (e.g. `expressIntegration()` in `@sentry/node`), so
* `expressErrorHandler` reads its `shouldHandleError` back off the registered instance by name.
* `getShouldHandleError` is optional because not every platform's Express integration implements it.
*/
export interface ExpressIntegration extends Integration {
getShouldHandleError?: () => ExpressShouldHandleError | undefined;
}
export interface ExpressHandlerOptions {
/**
* Callback method deciding whether error should be captured and sent to Sentry
*
* @param error Captured middleware error
*
* @deprecated Configure `shouldHandleError` on `expressIntegration()` rather than here. Keep calling
* `setupExpressErrorHandler(app)` as that is what captures the errors. This option will be removed in v11.
*
* @example
*
* ```javascript
* Sentry.init({
* integrations: [
* Sentry.expressIntegration({
* shouldHandleError(error) {
* return (error.statusCode ?? 500) >= 500;
* },
* }),
* ],
* });
* ```
*/

@@ -159,0 +214,0 @@ shouldHandleError?(this: void, error: MiddlewareError): boolean;

@@ -1,1 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I,KACnC,IAAI,CAAC;AAEV,gGAAgG;AAChG,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,EAAE,eAAe,KAAK,OAAO,CAAC,GAAG,KAAK,CAAC;AAErF;;;;GAIG;AACH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,oBAAoB,CAAC,EAAE,MAAM,wBAAwB,GAAG,SAAS,CAAC;CACnE;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,iBAAiB,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC;CACjE"}

@@ -18,3 +18,3 @@ /**

export { patchExpressModule, setupExpressErrorHandler, expressErrorHandler } from './integrations/express/index';
export type { ExpressIntegrationOptions, ExpressHandlerOptions, ExpressMiddleware, ExpressErrorMiddleware, } from './integrations/express/types';
export type { ExpressIntegration, ExpressIntegrationOptions, ExpressHandlerOptions, ExpressMiddleware, ExpressErrorMiddleware, ExpressShouldHandleError, } from './integrations/express/types';
export { instrumentPostgresJsSql, _sanitizeSqlQuery as _INTERNAL_sanitizeSqlQuery, _reconstructQuery as _INTERNAL_reconstructPostgresQuery, _buildConnectionContext as _INTERNAL_buildPostgresConnectionContext, _setConnectionAttributes as _INTERNAL_setPostgresConnectionAttributes, _setOperationName as _INTERNAL_setPostgresOperationName, } from './integrations/postgresjs';

@@ -21,0 +21,0 @@ export type { PostgresConnectionContext } from './integrations/postgresjs';

@@ -1,1 +0,1 @@

{"version":3,"file":"server-exports.d.ts","sourceRoot":"","sources":["../../src/server-exports.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,QA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C/C,iBAAiB,IAAI,kCAAkC,EACvD,uBAAuB,IAAI,wCAAwC,EACnE,wBAAwB,IAAI,yCAAyC,EACrE,iBAAiB,IAAI,kCAAkC,GACxD,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,kBAAkB,IAAI,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAEjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC3G,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAClF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC;AACnG,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,8BAA8B,EAC9B,iBAAiB,GAClB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC/F,YAAY,EACV,0BAA0B,EAC1B,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC"}
{
"name": "@sentry/core",
"version": "10.72.0",
"version": "10.73.0",
"description": "Base implementation for all Sentry JavaScript SDKs",

@@ -5,0 +5,0 @@ "repository": "git://github.com/getsentry/sentry-javascript.git",