Object.defineProperty(exports, '__esModule', { value: true }); const core = require('@sentry/core'); const edgeWrapperUtils = require('../common/utils/edgeWrapperUtils.js'); /** * Wraps a Next.js edge route handler with Sentry error and performance instrumentation. */ function wrapApiHandlerWithSentry( handler, parameterizedRoute, ) { return new Proxy(handler, { apply: (wrappingTarget, thisArg, args) => { const req = args[0]; const activeSpan = core.getActiveSpan(); const wrappedHandler = edgeWrapperUtils.withEdgeWrapping(wrappingTarget, { spanDescription: activeSpan || !(req instanceof Request) ? `handler (${parameterizedRoute})` : `${req.method} ${parameterizedRoute}`, spanOp: activeSpan ? 'function' : 'http.server', mechanismFunctionName: 'wrapApiHandlerWithSentry', }); return wrappedHandler.apply(thisArg, args); }, }); } /** * @deprecated Use `wrapApiHandlerWithSentry` instead. */ const withSentryAPI = wrapApiHandlerWithSentry; exports.withSentryAPI = withSentryAPI; exports.wrapApiHandlerWithSentry = wrapApiHandlerWithSentry; //# sourceMappingURL=wrapApiHandlerWithSentry.js.map