@sentry/core 10.52.0 → 10.53.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/browser.d.ts +4 -0
  2. package/browser.js +3 -0
  3. package/build/cjs/browser.js +529 -0
  4. package/build/cjs/browser.js.map +1 -0
  5. package/build/cjs/client.js +9 -0
  6. package/build/cjs/client.js.map +1 -1
  7. package/build/cjs/index.js +69 -68
  8. package/build/cjs/index.js.map +1 -1
  9. package/build/cjs/instrument/console.js +43 -3
  10. package/build/cjs/instrument/console.js.map +1 -1
  11. package/build/cjs/integrations/captureconsole.js +2 -2
  12. package/build/cjs/integrations/captureconsole.js.map +1 -1
  13. package/build/cjs/integrations/console.js +5 -1
  14. package/build/cjs/integrations/console.js.map +1 -1
  15. package/build/cjs/integrations/express/index.js +2 -2
  16. package/build/cjs/integrations/express/index.js.map +1 -1
  17. package/build/cjs/integrations/mcp-server/errorCapture.js +2 -2
  18. package/build/cjs/integrations/mcp-server/errorCapture.js.map +1 -1
  19. package/build/cjs/integrations/mcp-server/handlers.js +72 -0
  20. package/build/cjs/integrations/mcp-server/handlers.js.map +1 -1
  21. package/build/cjs/integrations/mcp-server/index.js +10 -1
  22. package/build/cjs/integrations/mcp-server/index.js.map +1 -1
  23. package/build/cjs/integrations/supabase.js +4 -4
  24. package/build/cjs/integrations/supabase.js.map +1 -1
  25. package/build/cjs/semanticAttributes.js +4 -4
  26. package/build/cjs/semanticAttributes.js.map +1 -1
  27. package/build/cjs/server.js +563 -0
  28. package/build/cjs/server.js.map +1 -0
  29. package/build/cjs/tracing/ai/utils.js +2 -2
  30. package/build/cjs/tracing/ai/utils.js.map +1 -1
  31. package/build/cjs/tracing/anthropic-ai/index.js +3 -3
  32. package/build/cjs/tracing/anthropic-ai/index.js.map +1 -1
  33. package/build/cjs/tracing/anthropic-ai/streaming.js +3 -3
  34. package/build/cjs/tracing/anthropic-ai/streaming.js.map +1 -1
  35. package/build/cjs/tracing/anthropic-ai/utils.js +2 -2
  36. package/build/cjs/tracing/anthropic-ai/utils.js.map +1 -1
  37. package/build/cjs/tracing/google-genai/index.js +3 -3
  38. package/build/cjs/tracing/google-genai/index.js.map +1 -1
  39. package/build/cjs/tracing/google-genai/streaming.js +2 -2
  40. package/build/cjs/tracing/google-genai/streaming.js.map +1 -1
  41. package/build/cjs/tracing/langchain/embeddings.js +2 -2
  42. package/build/cjs/tracing/langchain/embeddings.js.map +1 -1
  43. package/build/cjs/tracing/langchain/index.js +4 -4
  44. package/build/cjs/tracing/langchain/index.js.map +1 -1
  45. package/build/cjs/tracing/langgraph/index.js +3 -3
  46. package/build/cjs/tracing/langgraph/index.js.map +1 -1
  47. package/build/cjs/tracing/langgraph/utils.js +2 -2
  48. package/build/cjs/tracing/langgraph/utils.js.map +1 -1
  49. package/build/cjs/tracing/openai/index.js +3 -3
  50. package/build/cjs/tracing/openai/index.js.map +1 -1
  51. package/build/cjs/tracing/openai/streaming.js +2 -2
  52. package/build/cjs/tracing/openai/streaming.js.map +1 -1
  53. package/build/cjs/tracing/sentrySpan.js +5 -0
  54. package/build/cjs/tracing/sentrySpan.js.map +1 -1
  55. package/build/cjs/tracing/spans/captureSpan.js +5 -9
  56. package/build/cjs/tracing/spans/captureSpan.js.map +1 -1
  57. package/build/cjs/tracing/spans/extractGenAiSpans.js +60 -0
  58. package/build/cjs/tracing/spans/extractGenAiSpans.js.map +1 -0
  59. package/build/cjs/tracing/spans/spanJsonToStreamedSpan.js +26 -0
  60. package/build/cjs/tracing/spans/spanJsonToStreamedSpan.js.map +1 -0
  61. package/build/cjs/tracing/vercel-ai/index.js +6 -1
  62. package/build/cjs/tracing/vercel-ai/index.js.map +1 -1
  63. package/build/cjs/trpc.js +3 -3
  64. package/build/cjs/trpc.js.map +1 -1
  65. package/build/cjs/utils/exports.js +7 -7
  66. package/build/cjs/utils/exports.js.map +1 -1
  67. package/build/cjs/utils/flushIfServerless.js +2 -2
  68. package/build/cjs/utils/flushIfServerless.js.map +1 -1
  69. package/build/cjs/utils/string.js +9 -2
  70. package/build/cjs/utils/string.js.map +1 -1
  71. package/build/cjs/utils/traceData.js +2 -2
  72. package/build/cjs/utils/traceData.js.map +1 -1
  73. package/build/cjs/utils/version.js +1 -1
  74. package/build/esm/browser.js +142 -0
  75. package/build/esm/browser.js.map +1 -0
  76. package/build/esm/client.js +9 -0
  77. package/build/esm/client.js.map +1 -1
  78. package/build/esm/index.js +17 -17
  79. package/build/esm/instrument/console.js +44 -5
  80. package/build/esm/instrument/console.js.map +1 -1
  81. package/build/esm/integrations/console.js +6 -2
  82. package/build/esm/integrations/console.js.map +1 -1
  83. package/build/esm/integrations/mcp-server/handlers.js +72 -1
  84. package/build/esm/integrations/mcp-server/handlers.js.map +1 -1
  85. package/build/esm/integrations/mcp-server/index.js +11 -2
  86. package/build/esm/integrations/mcp-server/index.js.map +1 -1
  87. package/build/esm/package.json +1 -1
  88. package/build/esm/semanticAttributes.js +4 -4
  89. package/build/esm/semanticAttributes.js.map +1 -1
  90. package/build/esm/server.js +157 -0
  91. package/build/esm/server.js.map +1 -0
  92. package/build/esm/tracing/sentrySpan.js +5 -0
  93. package/build/esm/tracing/sentrySpan.js.map +1 -1
  94. package/build/esm/tracing/spans/captureSpan.js +5 -9
  95. package/build/esm/tracing/spans/captureSpan.js.map +1 -1
  96. package/build/esm/tracing/spans/extractGenAiSpans.js +58 -0
  97. package/build/esm/tracing/spans/extractGenAiSpans.js.map +1 -0
  98. package/build/esm/tracing/spans/spanJsonToStreamedSpan.js +24 -0
  99. package/build/esm/tracing/spans/spanJsonToStreamedSpan.js.map +1 -0
  100. package/build/esm/tracing/vercel-ai/index.js +6 -1
  101. package/build/esm/tracing/vercel-ai/index.js.map +1 -1
  102. package/build/esm/utils/exports.js +7 -7
  103. package/build/esm/utils/exports.js.map +1 -1
  104. package/build/esm/utils/string.js +9 -2
  105. package/build/esm/utils/string.js.map +1 -1
  106. package/build/esm/utils/version.js +1 -1
  107. package/build/types/browser-exports.d.ts +11 -0
  108. package/build/types/browser-exports.d.ts.map +1 -0
  109. package/build/types/browser.d.ts +3 -0
  110. package/build/types/browser.d.ts.map +1 -0
  111. package/build/types/build-time-plugins/buildTimeOptionsBase.d.ts +8 -0
  112. package/build/types/build-time-plugins/buildTimeOptionsBase.d.ts.map +1 -1
  113. package/build/types/carrier.d.ts +1 -1
  114. package/build/types/carrier.d.ts.map +1 -1
  115. package/build/types/client.d.ts.map +1 -1
  116. package/build/types/index.d.ts +3 -232
  117. package/build/types/index.d.ts.map +1 -1
  118. package/build/types/instrument/console.d.ts +7 -0
  119. package/build/types/instrument/console.d.ts.map +1 -1
  120. package/build/types/integrations/captureconsole.d.ts +1 -1
  121. package/build/types/integrations/captureconsole.d.ts.map +1 -1
  122. package/build/types/integrations/console.d.ts +5 -0
  123. package/build/types/integrations/console.d.ts.map +1 -1
  124. package/build/types/integrations/conversationId.d.ts +1 -1
  125. package/build/types/integrations/conversationId.d.ts.map +1 -1
  126. package/build/types/integrations/dedupe.d.ts +1 -1
  127. package/build/types/integrations/dedupe.d.ts.map +1 -1
  128. package/build/types/integrations/eventFilters.d.ts +2 -2
  129. package/build/types/integrations/eventFilters.d.ts.map +1 -1
  130. package/build/types/integrations/extraerrordata.d.ts +1 -1
  131. package/build/types/integrations/extraerrordata.d.ts.map +1 -1
  132. package/build/types/integrations/functiontostring.d.ts +1 -1
  133. package/build/types/integrations/functiontostring.d.ts.map +1 -1
  134. package/build/types/integrations/linkederrors.d.ts +1 -1
  135. package/build/types/integrations/linkederrors.d.ts.map +1 -1
  136. package/build/types/integrations/mcp-server/handlers.d.ts +18 -0
  137. package/build/types/integrations/mcp-server/handlers.d.ts.map +1 -1
  138. package/build/types/integrations/mcp-server/index.d.ts +8 -1
  139. package/build/types/integrations/mcp-server/index.d.ts.map +1 -1
  140. package/build/types/integrations/requestdata.d.ts +1 -1
  141. package/build/types/integrations/requestdata.d.ts.map +1 -1
  142. package/build/types/integrations/spanStreaming.d.ts +1 -1
  143. package/build/types/integrations/spanStreaming.d.ts.map +1 -1
  144. package/build/types/integrations/supabase.d.ts +1 -1
  145. package/build/types/integrations/supabase.d.ts.map +1 -1
  146. package/build/types/integrations/zoderrors.d.ts +1 -1
  147. package/build/types/integrations/zoderrors.d.ts.map +1 -1
  148. package/build/types/logs/console-integration.d.ts +1 -1
  149. package/build/types/logs/console-integration.d.ts.map +1 -1
  150. package/build/types/semanticAttributes.d.ts +4 -4
  151. package/build/types/semanticAttributes.d.ts.map +1 -1
  152. package/build/types/server-exports.d.ts +26 -0
  153. package/build/types/server-exports.d.ts.map +1 -0
  154. package/build/types/server.d.ts +10 -0
  155. package/build/types/server.d.ts.map +1 -0
  156. package/build/types/shared-exports.d.ts +215 -0
  157. package/build/types/shared-exports.d.ts.map +1 -0
  158. package/build/types/tracing/sentrySpan.d.ts.map +1 -1
  159. package/build/types/tracing/spans/captureSpan.d.ts.map +1 -1
  160. package/build/types/tracing/spans/extractGenAiSpans.d.ts +15 -0
  161. package/build/types/tracing/spans/extractGenAiSpans.d.ts.map +1 -0
  162. package/build/types/tracing/spans/spanJsonToStreamedSpan.d.ts +6 -0
  163. package/build/types/tracing/spans/spanJsonToStreamedSpan.d.ts.map +1 -0
  164. package/build/types/tracing/vercel-ai/index.d.ts.map +1 -1
  165. package/build/types/types-hoist/envelope.d.ts +1 -1
  166. package/build/types/types-hoist/envelope.d.ts.map +1 -1
  167. package/build/types/types-hoist/options.d.ts +8 -0
  168. package/build/types/types-hoist/options.d.ts.map +1 -1
  169. package/build/types/utils/string.d.ts +1 -1
  170. package/build/types/utils/string.d.ts.map +1 -1
  171. package/build/types-ts3.8/browser-exports.d.ts +11 -0
  172. package/build/types-ts3.8/browser.d.ts +3 -0
  173. package/build/types-ts3.8/build-time-plugins/buildTimeOptionsBase.d.ts +8 -0
  174. package/build/types-ts3.8/carrier.d.ts +1 -1
  175. package/build/types-ts3.8/index.d.ts +3 -234
  176. package/build/types-ts3.8/instrument/console.d.ts +7 -0
  177. package/build/types-ts3.8/integrations/captureconsole.d.ts +1 -1
  178. package/build/types-ts3.8/integrations/console.d.ts +5 -0
  179. package/build/types-ts3.8/integrations/conversationId.d.ts +1 -1
  180. package/build/types-ts3.8/integrations/dedupe.d.ts +1 -1
  181. package/build/types-ts3.8/integrations/eventFilters.d.ts +2 -2
  182. package/build/types-ts3.8/integrations/extraerrordata.d.ts +1 -1
  183. package/build/types-ts3.8/integrations/functiontostring.d.ts +1 -1
  184. package/build/types-ts3.8/integrations/linkederrors.d.ts +1 -1
  185. package/build/types-ts3.8/integrations/mcp-server/handlers.d.ts +18 -0
  186. package/build/types-ts3.8/integrations/mcp-server/index.d.ts +8 -1
  187. package/build/types-ts3.8/integrations/requestdata.d.ts +1 -1
  188. package/build/types-ts3.8/integrations/spanStreaming.d.ts +1 -1
  189. package/build/types-ts3.8/integrations/supabase.d.ts +1 -1
  190. package/build/types-ts3.8/integrations/zoderrors.d.ts +1 -1
  191. package/build/types-ts3.8/logs/console-integration.d.ts +1 -1
  192. package/build/types-ts3.8/semanticAttributes.d.ts +4 -4
  193. package/build/types-ts3.8/server-exports.d.ts +21 -0
  194. package/build/types-ts3.8/server.d.ts +10 -0
  195. package/build/types-ts3.8/shared-exports.d.ts +214 -0
  196. package/build/types-ts3.8/tracing/spans/extractGenAiSpans.d.ts +15 -0
  197. package/build/types-ts3.8/tracing/spans/spanJsonToStreamedSpan.d.ts +6 -0
  198. package/build/types-ts3.8/types-hoist/envelope.d.ts +1 -1
  199. package/build/types-ts3.8/types-hoist/options.d.ts +8 -0
  200. package/build/types-ts3.8/utils/string.d.ts +1 -1
  201. package/package.json +32 -2
  202. package/server.d.ts +4 -0
  203. package/server.js +3 -0
@@ -14,7 +14,7 @@ const logSpans = require('./tracing/logSpans.js');
14
14
  const captureSpan = require('./tracing/spans/captureSpan.js');
15
15
  const semanticAttributes = require('./semanticAttributes.js');
16
16
  const envelope$1 = require('./envelope.js');
17
- const _exports = require('./exports.js');
17
+ const exports$1 = require('./exports.js');
18
18
  const currentScopes = require('./currentScopes.js');
19
19
  const defaultScopes = require('./defaultScopes.js');
20
20
  const index$7 = require('./asyncContext/index.js');
@@ -24,7 +24,6 @@ const scope = require('./scope.js');
24
24
  const eventProcessors = require('./eventProcessors.js');
25
25
  const api = require('./api.js');
26
26
  const client = require('./client.js');
27
- const serverRuntimeClient = require('./server-runtime-client.js');
28
27
  const sdk = require('./sdk.js');
29
28
  const base = require('./transports/base.js');
30
29
  const offline = require('./transports/offline.js');
@@ -61,27 +60,18 @@ const linkederrors = require('./integrations/linkederrors.js');
61
60
  const moduleMetadata = require('./integrations/moduleMetadata.js');
62
61
  const requestdata = require('./integrations/requestdata.js');
63
62
  const captureconsole = require('./integrations/captureconsole.js');
64
- const index$2 = require('./integrations/express/index.js');
65
63
  const dedupe = require('./integrations/dedupe.js');
66
64
  const extraerrordata = require('./integrations/extraerrordata.js');
67
65
  const rewriteframes = require('./integrations/rewriteframes.js');
68
66
  const supabase = require('./integrations/supabase.js');
69
- const postgresjs = require('./integrations/postgresjs.js');
70
67
  const zoderrors = require('./integrations/zoderrors.js');
71
68
  const thirdPartyErrorsFilter = require('./integrations/third-party-errors-filter.js');
72
69
  const console$1 = require('./integrations/console.js');
73
70
  const featureFlagsIntegration = require('./integrations/featureFlags/featureFlagsIntegration.js');
74
71
  const growthbook = require('./integrations/featureFlags/growthbook.js');
75
72
  const conversationId = require('./integrations/conversationId.js');
76
- const clientPatch = require('./integrations/http/client-patch.js');
77
- const clientSubscriptions = require('./integrations/http/client-subscriptions.js');
78
- const addOutgoingRequestBreadcrumb = require('./integrations/http/add-outgoing-request-breadcrumb.js');
79
- const getRequestUrl = require('./integrations/http/get-request-url.js');
80
- const constants$3 = require('./integrations/http/constants.js');
81
73
  const profiling = require('./profiling.js');
82
74
  const fetch = require('./fetch.js');
83
- const trpc = require('./trpc.js');
84
- const index$8 = require('./integrations/mcp-server/index.js');
85
75
  const feedback = require('./feedback.js');
86
76
  const internal = require('./logs/internal.js');
87
77
  const publicApi = require('./logs/public-api.js');
@@ -108,7 +98,6 @@ const spanStreaming = require('./integrations/spanStreaming.js');
108
98
  const featureFlags = require('./utils/featureFlags.js');
109
99
  const aggregateErrors = require('./utils/aggregate-errors.js');
110
100
  const breadcrumbLogLevel = require('./utils/breadcrumb-log-level.js');
111
- const browser = require('./utils/browser.js');
112
101
  const dsn = require('./utils/dsn.js');
113
102
  const error = require('./utils/error.js');
114
103
  const worldwide = require('./utils/worldwide.js');
@@ -121,16 +110,14 @@ const is = require('./utils/is.js');
121
110
  const isBrowser = require('./utils/isBrowser.js');
122
111
  const debugLogger = require('./utils/debug-logger.js');
123
112
  const misc = require('./utils/misc.js');
124
- const node = require('./utils/node.js');
125
113
  const normalize = require('./utils/normalize.js');
126
114
  const normalizationHints = require('./utils/normalizationHints.js');
127
115
  const object = require('./utils/object.js');
128
116
  const path = require('./utils/path.js');
129
117
  const promisebuffer = require('./utils/promisebuffer.js');
130
118
  const severity = require('./utils/severity.js');
131
- const _exports$1 = require('./utils/exports.js');
119
+ const exports$2 = require('./utils/exports.js');
132
120
  const stacktrace = require('./utils/stacktrace.js');
133
- const nodeStackTrace = require('./utils/node-stack-trace.js');
134
121
  const string = require('./utils/string.js');
135
122
  const supports = require('./utils/supports.js');
136
123
  const syncpromise = require('./utils/syncpromise.js');
@@ -143,17 +130,30 @@ const ratelimit = require('./utils/ratelimit.js');
143
130
  const baggage = require('./utils/baggage.js');
144
131
  const url = require('./utils/url.js');
145
132
  const eventbuilder = require('./utils/eventbuilder.js');
146
- const anr = require('./utils/anr.js');
147
133
  const lru = require('./utils/lru.js');
148
134
  const propagationContext = require('./utils/propagationContext.js');
149
- const vercelWaitUntil = require('./utils/vercelWaitUntil.js');
150
- const flushIfServerless = require('./utils/flushIfServerless.js');
151
135
  const version = require('./utils/version.js');
152
136
  const debugIds = require('./utils/debug-ids.js');
153
137
  const metadata = require('./metadata.js');
154
138
  const escapeStringForRegex = require('./vendor/escapeStringForRegex.js');
155
139
  const randomSafeContext = require('./utils/randomSafeContext.js');
140
+ const serverRuntimeClient = require('./server-runtime-client.js');
141
+ const trpc = require('./trpc.js');
142
+ const index$8 = require('./integrations/mcp-server/index.js');
143
+ const node = require('./utils/node.js');
144
+ const nodeStackTrace = require('./utils/node-stack-trace.js');
145
+ const vercelWaitUntil = require('./utils/vercelWaitUntil.js');
146
+ const flushIfServerless = require('./utils/flushIfServerless.js');
147
+ const anr = require('./utils/anr.js');
156
148
  const timer = require('./utils/timer.js');
149
+ const index$2 = require('./integrations/express/index.js');
150
+ const postgresjs = require('./integrations/postgresjs.js');
151
+ const clientPatch = require('./integrations/http/client-patch.js');
152
+ const clientSubscriptions = require('./integrations/http/client-subscriptions.js');
153
+ const addOutgoingRequestBreadcrumb = require('./integrations/http/add-outgoing-request-breadcrumb.js');
154
+ const getRequestUrl = require('./integrations/http/get-request-url.js');
155
+ const constants$3 = require('./integrations/http/constants.js');
156
+ const browser = require('./utils/browser.js');
157
157
  const embeddings = require('./tracing/langchain/embeddings.js');
158
158
 
159
159
 
@@ -220,27 +220,27 @@ exports.SEMANTIC_LINK_ATTRIBUTE_LINK_TYPE = semanticAttributes.SEMANTIC_LINK_ATT
220
220
  exports.createEventEnvelope = envelope$1.createEventEnvelope;
221
221
  exports.createSessionEnvelope = envelope$1.createSessionEnvelope;
222
222
  exports.createSpanEnvelope = envelope$1.createSpanEnvelope;
223
- exports.addEventProcessor = _exports.addEventProcessor;
224
- exports.captureCheckIn = _exports.captureCheckIn;
225
- exports.captureEvent = _exports.captureEvent;
226
- exports.captureException = _exports.captureException;
227
- exports.captureMessage = _exports.captureMessage;
228
- exports.captureSession = _exports.captureSession;
229
- exports.close = _exports.close;
230
- exports.endSession = _exports.endSession;
231
- exports.flush = _exports.flush;
232
- exports.isEnabled = _exports.isEnabled;
233
- exports.isInitialized = _exports.isInitialized;
234
- exports.lastEventId = _exports.lastEventId;
235
- exports.setContext = _exports.setContext;
236
- exports.setConversationId = _exports.setConversationId;
237
- exports.setExtra = _exports.setExtra;
238
- exports.setExtras = _exports.setExtras;
239
- exports.setTag = _exports.setTag;
240
- exports.setTags = _exports.setTags;
241
- exports.setUser = _exports.setUser;
242
- exports.startSession = _exports.startSession;
243
- exports.withMonitor = _exports.withMonitor;
223
+ exports.addEventProcessor = exports$1.addEventProcessor;
224
+ exports.captureCheckIn = exports$1.captureCheckIn;
225
+ exports.captureEvent = exports$1.captureEvent;
226
+ exports.captureException = exports$1.captureException;
227
+ exports.captureMessage = exports$1.captureMessage;
228
+ exports.captureSession = exports$1.captureSession;
229
+ exports.close = exports$1.close;
230
+ exports.endSession = exports$1.endSession;
231
+ exports.flush = exports$1.flush;
232
+ exports.isEnabled = exports$1.isEnabled;
233
+ exports.isInitialized = exports$1.isInitialized;
234
+ exports.lastEventId = exports$1.lastEventId;
235
+ exports.setContext = exports$1.setContext;
236
+ exports.setConversationId = exports$1.setConversationId;
237
+ exports.setExtra = exports$1.setExtra;
238
+ exports.setExtras = exports$1.setExtras;
239
+ exports.setTag = exports$1.setTag;
240
+ exports.setTags = exports$1.setTags;
241
+ exports.setUser = exports$1.setUser;
242
+ exports.startSession = exports$1.startSession;
243
+ exports.withMonitor = exports$1.withMonitor;
244
244
  exports.getClient = currentScopes.getClient;
245
245
  exports.getCurrentScope = currentScopes.getCurrentScope;
246
246
  exports.getExternalPropagationContext = currentScopes.getExternalPropagationContext;
@@ -265,7 +265,6 @@ exports.SENTRY_API_VERSION = api.SENTRY_API_VERSION;
265
265
  exports.getEnvelopeEndpointWithUrlEncodedAuth = api.getEnvelopeEndpointWithUrlEncodedAuth;
266
266
  exports.getReportDialogEndpoint = api.getReportDialogEndpoint;
267
267
  exports.Client = client.Client;
268
- exports.ServerRuntimeClient = serverRuntimeClient.ServerRuntimeClient;
269
268
  exports.initAndBind = sdk.initAndBind;
270
269
  exports.setCurrentClient = sdk.setCurrentClient;
271
270
  exports.createTransport = base.createTransport;
@@ -338,35 +337,20 @@ exports.linkedErrorsIntegration = linkederrors.linkedErrorsIntegration;
338
337
  exports.moduleMetadataIntegration = moduleMetadata.moduleMetadataIntegration;
339
338
  exports.requestDataIntegration = requestdata.requestDataIntegration;
340
339
  exports.captureConsoleIntegration = captureconsole.captureConsoleIntegration;
341
- exports.expressErrorHandler = index$2.expressErrorHandler;
342
- exports.patchExpressModule = index$2.patchExpressModule;
343
- exports.setupExpressErrorHandler = index$2.setupExpressErrorHandler;
344
340
  exports.dedupeIntegration = dedupe.dedupeIntegration;
345
341
  exports.extraErrorDataIntegration = extraerrordata.extraErrorDataIntegration;
346
342
  exports.rewriteFramesIntegration = rewriteframes.rewriteFramesIntegration;
347
343
  exports.instrumentSupabaseClient = supabase.instrumentSupabaseClient;
348
344
  exports.supabaseIntegration = supabase.supabaseIntegration;
349
- exports.instrumentPostgresJsSql = postgresjs.instrumentPostgresJsSql;
350
345
  exports.zodErrorsIntegration = zoderrors.zodErrorsIntegration;
351
346
  exports.thirdPartyErrorFilterIntegration = thirdPartyErrorsFilter.thirdPartyErrorFilterIntegration;
352
347
  exports.consoleIntegration = console$1.consoleIntegration;
353
348
  exports.featureFlagsIntegration = featureFlagsIntegration.featureFlagsIntegration;
354
349
  exports.growthbookIntegration = growthbook.growthbookIntegration;
355
350
  exports.conversationIdIntegration = conversationId.conversationIdIntegration;
356
- exports.patchHttpModuleClient = clientPatch.patchHttpModuleClient;
357
- exports.getHttpClientSubscriptions = clientSubscriptions.getHttpClientSubscriptions;
358
- exports.addOutgoingRequestBreadcrumb = addOutgoingRequestBreadcrumb.addOutgoingRequestBreadcrumb;
359
- exports.getRequestOptions = getRequestUrl.getRequestOptions;
360
- exports.getRequestUrl = getRequestUrl.getRequestUrl;
361
- exports.getRequestUrlFromClientRequest = getRequestUrl.getRequestUrlFromClientRequest;
362
- exports.getRequestUrlObject = getRequestUrl.getRequestUrlObject;
363
- exports.HTTP_ON_CLIENT_REQUEST = constants$3.HTTP_ON_CLIENT_REQUEST;
364
- exports.HTTP_ON_SERVER_REQUEST = constants$3.HTTP_ON_SERVER_REQUEST;
365
351
  exports.profiler = profiling.profiler;
366
352
  exports._INTERNAL_getTracingHeadersForFetchRequest = fetch._INTERNAL_getTracingHeadersForFetchRequest;
367
353
  exports.instrumentFetchRequest = fetch.instrumentFetchRequest;
368
- exports.trpcMiddleware = trpc.trpcMiddleware;
369
- exports.wrapMcpServerWithSentry = index$8.wrapMcpServerWithSentry;
370
354
  exports.captureFeedback = feedback.captureFeedback;
371
355
  exports._INTERNAL_captureLog = internal._INTERNAL_captureLog;
372
356
  exports._INTERNAL_captureSerializedLog = internal._INTERNAL_captureSerializedLog;
@@ -404,14 +388,12 @@ exports._INTERNAL_copyFlagsFromScopeToEvent = featureFlags._INTERNAL_copyFlagsFr
404
388
  exports._INTERNAL_insertFlagToScope = featureFlags._INTERNAL_insertFlagToScope;
405
389
  exports.applyAggregateErrorsToEvent = aggregateErrors.applyAggregateErrorsToEvent;
406
390
  exports.getBreadcrumbLogLevelFromHttpStatusCode = breadcrumbLogLevel.getBreadcrumbLogLevelFromHttpStatusCode;
407
- exports.getComponentName = browser.getComponentName;
408
- exports.getLocationHref = browser.getLocationHref;
409
- exports.htmlTreeAsString = browser.htmlTreeAsString;
410
391
  exports.dsnFromString = dsn.dsnFromString;
411
392
  exports.dsnToString = dsn.dsnToString;
412
393
  exports.makeDsn = dsn.makeDsn;
413
394
  exports.SentryError = error.SentryError;
414
395
  exports.GLOBAL_OBJ = worldwide.GLOBAL_OBJ;
396
+ exports.addConsoleInstrumentationFilter = console.addConsoleInstrumentationFilter;
415
397
  exports.addConsoleInstrumentationHandler = console.addConsoleInstrumentationHandler;
416
398
  exports.addFetchEndInstrumentationHandler = fetch$1.addFetchEndInstrumentationHandler;
417
399
  exports.addFetchInstrumentationHandler = fetch$1.addFetchInstrumentationHandler;
@@ -449,8 +431,6 @@ exports.getEventDescription = misc.getEventDescription;
449
431
  exports.isAlreadyCaptured = misc.isAlreadyCaptured;
450
432
  exports.parseSemver = misc.parseSemver;
451
433
  exports.uuid4 = misc.uuid4;
452
- exports.isNodeEnv = node.isNodeEnv;
453
- exports.loadModule = node.loadModule;
454
434
  exports.normalize = normalize.normalize;
455
435
  exports.normalizeToSize = normalize.normalizeToSize;
456
436
  exports.normalizeUrlToBase = normalize.normalizeUrlToBase;
@@ -474,16 +454,13 @@ exports.resolve = path.resolve;
474
454
  exports.SENTRY_BUFFER_FULL_ERROR = promisebuffer.SENTRY_BUFFER_FULL_ERROR;
475
455
  exports.makePromiseBuffer = promisebuffer.makePromiseBuffer;
476
456
  exports.severityLevelFromString = severity.severityLevelFromString;
477
- exports.replaceExports = _exports$1.replaceExports;
457
+ exports.replaceExports = exports$2.replaceExports;
478
458
  exports.UNKNOWN_FUNCTION = stacktrace.UNKNOWN_FUNCTION;
479
459
  exports.createStackParser = stacktrace.createStackParser;
480
460
  exports.getFramesFromEvent = stacktrace.getFramesFromEvent;
481
461
  exports.getFunctionName = stacktrace.getFunctionName;
482
462
  exports.stackParserFromStackParserOptions = stacktrace.stackParserFromStackParserOptions;
483
463
  exports.stripSentryFramesAndReverse = stacktrace.stripSentryFramesAndReverse;
484
- exports.filenameIsInApp = nodeStackTrace.filenameIsInApp;
485
- exports.node = nodeStackTrace.node;
486
- exports.nodeStackLineParser = nodeStackTrace.nodeStackLineParser;
487
464
  exports.isMatchingPattern = string.isMatchingPattern;
488
465
  exports.safeJoin = string.safeJoin;
489
466
  exports.snipLine = string.snipLine;
@@ -550,13 +527,9 @@ exports.eventFromMessage = eventbuilder.eventFromMessage;
550
527
  exports.eventFromUnknownInput = eventbuilder.eventFromUnknownInput;
551
528
  exports.exceptionFromError = eventbuilder.exceptionFromError;
552
529
  exports.parseStackFrames = eventbuilder.parseStackFrames;
553
- exports.callFrameToStackFrame = anr.callFrameToStackFrame;
554
- exports.watchdogTimer = anr.watchdogTimer;
555
530
  exports.LRUMap = lru.LRUMap;
556
531
  exports.generateSpanId = propagationContext.generateSpanId;
557
532
  exports.generateTraceId = propagationContext.generateTraceId;
558
- exports.vercelWaitUntil = vercelWaitUntil.vercelWaitUntil;
559
- exports.flushIfServerless = flushIfServerless.flushIfServerless;
560
533
  exports.SDK_VERSION = version.SDK_VERSION;
561
534
  exports.getDebugImagesForResources = debugIds.getDebugImagesForResources;
562
535
  exports.getFilenameToDebugIdMap = debugIds.getFilenameToDebugIdMap;
@@ -565,6 +538,34 @@ exports.escapeStringForRegex = escapeStringForRegex.escapeStringForRegex;
565
538
  exports._INTERNAL_safeDateNow = randomSafeContext.safeDateNow;
566
539
  exports._INTERNAL_safeMathRandom = randomSafeContext.safeMathRandom;
567
540
  exports._INTERNAL_withRandomSafeContext = randomSafeContext.withRandomSafeContext;
541
+ exports.ServerRuntimeClient = serverRuntimeClient.ServerRuntimeClient;
542
+ exports.trpcMiddleware = trpc.trpcMiddleware;
543
+ exports.wrapMcpServerWithSentry = index$8.wrapMcpServerWithSentry;
544
+ exports.isNodeEnv = node.isNodeEnv;
545
+ exports.loadModule = node.loadModule;
546
+ exports.filenameIsInApp = nodeStackTrace.filenameIsInApp;
547
+ exports.node = nodeStackTrace.node;
548
+ exports.nodeStackLineParser = nodeStackTrace.nodeStackLineParser;
549
+ exports.vercelWaitUntil = vercelWaitUntil.vercelWaitUntil;
550
+ exports.flushIfServerless = flushIfServerless.flushIfServerless;
551
+ exports.callFrameToStackFrame = anr.callFrameToStackFrame;
552
+ exports.watchdogTimer = anr.watchdogTimer;
568
553
  exports._INTERNAL_safeUnref = timer.safeUnref;
554
+ exports.expressErrorHandler = index$2.expressErrorHandler;
555
+ exports.patchExpressModule = index$2.patchExpressModule;
556
+ exports.setupExpressErrorHandler = index$2.setupExpressErrorHandler;
557
+ exports.instrumentPostgresJsSql = postgresjs.instrumentPostgresJsSql;
558
+ exports.patchHttpModuleClient = clientPatch.patchHttpModuleClient;
559
+ exports.getHttpClientSubscriptions = clientSubscriptions.getHttpClientSubscriptions;
560
+ exports.addOutgoingRequestBreadcrumb = addOutgoingRequestBreadcrumb.addOutgoingRequestBreadcrumb;
561
+ exports.getRequestOptions = getRequestUrl.getRequestOptions;
562
+ exports.getRequestUrl = getRequestUrl.getRequestUrl;
563
+ exports.getRequestUrlFromClientRequest = getRequestUrl.getRequestUrlFromClientRequest;
564
+ exports.getRequestUrlObject = getRequestUrl.getRequestUrlObject;
565
+ exports.HTTP_ON_CLIENT_REQUEST = constants$3.HTTP_ON_CLIENT_REQUEST;
566
+ exports.HTTP_ON_SERVER_REQUEST = constants$3.HTTP_ON_SERVER_REQUEST;
567
+ exports.getComponentName = browser.getComponentName;
568
+ exports.getLocationHref = browser.getLocationHref;
569
+ exports.htmlTreeAsString = browser.htmlTreeAsString;
569
570
  exports.instrumentLangChainEmbeddings = embeddings.instrumentLangChainEmbeddings;
570
571
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,10 +1,22 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
+ const debugBuild = require('../debug-build.js');
3
4
  const debugLogger = require('../utils/debug-logger.js');
4
5
  const object = require('../utils/object.js');
6
+ const string = require('../utils/string.js');
5
7
  const worldwide = require('../utils/worldwide.js');
6
8
  const handlers = require('./handlers.js');
7
9
 
10
+ /* eslint-disable @typescript-eslint/no-explicit-any */
11
+ /* eslint-disable @typescript-eslint/ban-types */
12
+
13
+ /**
14
+ * Filter out console messages that match the given strings or regular expressions.
15
+ * These will neither be passed to the handler, and they will also not be logged to the user, unless they have debug enabled.
16
+ * This is a set to avoid duplicate integration setups to add the same filter multiple times.
17
+ */
18
+ const _filter = new Set([]);
19
+
8
20
  /**
9
21
  * Add an instrumentation handler for when a console.xxx method is called.
10
22
  * Returns a function to remove the handler.
@@ -19,6 +31,22 @@ function addConsoleInstrumentationHandler(handler) {
19
31
  return removeHandler;
20
32
  }
21
33
 
34
+ /**
35
+ * Add a filter to the console instrumentation to filter out console messages that match the given strings or regular expressions.
36
+ * Returns a function to remove the filter.
37
+ */
38
+ function addConsoleInstrumentationFilter(filter) {
39
+ for (const f of filter) {
40
+ _filter.add(f);
41
+ }
42
+
43
+ return () => {
44
+ for (const f of filter) {
45
+ _filter.delete(f);
46
+ }
47
+ };
48
+ }
49
+
22
50
  function instrumentConsole() {
23
51
  if (!('console' in worldwide.GLOBAL_OBJ)) {
24
52
  return;
@@ -33,14 +61,26 @@ function instrumentConsole() {
33
61
  debugLogger.originalConsoleMethods[level] = originalConsoleMethod;
34
62
 
35
63
  return function (...args) {
36
- handlers.triggerHandlers('console', { args, level } );
37
-
64
+ const firstArg = args[0];
38
65
  const log = debugLogger.originalConsoleMethods[level];
39
- log?.apply(worldwide.GLOBAL_OBJ.console, args);
66
+
67
+ const isFiltered = _filter.size && typeof firstArg === 'string' && string.stringMatchesSomePattern(firstArg, _filter);
68
+
69
+ // Only trigger handlers for non-filtered messages
70
+ if (!isFiltered) {
71
+ handlers.triggerHandlers('console', { args, level } );
72
+ }
73
+
74
+ // Only log filtered messages in debug mode
75
+ if (!isFiltered || (debugBuild.DEBUG_BUILD && debugLogger.debug.isEnabled())) {
76
+ // Call original console method
77
+ log?.apply(worldwide.GLOBAL_OBJ.console, args);
78
+ }
40
79
  };
41
80
  });
42
81
  });
43
82
  }
44
83
 
84
+ exports.addConsoleInstrumentationFilter = addConsoleInstrumentationFilter;
45
85
  exports.addConsoleInstrumentationHandler = addConsoleInstrumentationHandler;
46
86
  //# sourceMappingURL=console.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"console.js","sources":["../../../src/instrument/console.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport type { ConsoleLevel, HandlerDataConsole } from '../types-hoist/instrument';\nimport { CONSOLE_LEVELS, originalConsoleMethods } from '../utils/debug-logger';\nimport { fill } from '../utils/object';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers';\n\n/**\n * Add an instrumentation handler for when a console.xxx method is called.\n * Returns a function to remove the handler.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addConsoleInstrumentationHandler(handler: (data: HandlerDataConsole) => void): () => void {\n const type = 'console';\n const removeHandler = addHandler(type, handler);\n maybeInstrument(type, instrumentConsole);\n return removeHandler;\n}\n\nfunction instrumentConsole(): void {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n CONSOLE_LEVELS.forEach(function (level: ConsoleLevel): void {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod: () => any): Function {\n originalConsoleMethods[level] = originalConsoleMethod;\n\n return function (...args: any[]): void {\n triggerHandlers('console', { args, level } as HandlerDataConsole);\n\n const log = originalConsoleMethods[level];\n log?.apply(GLOBAL_OBJ.console, args);\n };\n });\n });\n}\n"],"names":["addHandler","maybeInstrument","GLOBAL_OBJ","CONSOLE_LEVELS","fill","originalConsoleMethods","triggerHandlers"],"mappings":";;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAAkD;AAC1G,EAAE,MAAM,IAAA,GAAO,SAAS;AACxB,EAAE,MAAM,gBAAgBA,mBAAU,CAAC,IAAI,EAAE,OAAO,CAAC;AACjD,EAAEC,wBAAe,CAAC,IAAI,EAAE,iBAAiB,CAAC;AAC1C,EAAE,OAAO,aAAa;AACtB;;AAEA,SAAS,iBAAiB,GAAS;AACnC,EAAE,IAAI,EAAE,aAAaC,oBAAU,CAAC,EAAE;AAClC,IAAI;AACJ,EAAE;;AAEF,EAAEC,0BAAc,CAAC,OAAO,CAAC,UAAU,KAAK,EAAsB;AAC9D,IAAI,IAAI,EAAE,KAAA,IAASD,oBAAU,CAAC,OAAO,CAAC,EAAE;AACxC,MAAM;AACN,IAAI;;AAEJ,IAAIE,WAAI,CAACF,oBAAU,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,qBAAqB,EAAuB;AAC1F,MAAMG,kCAAsB,CAAC,KAAK,CAAA,GAAI,qBAAqB;;AAE3D,MAAM,OAAO,UAAU,GAAG,IAAI,EAAe;AAC7C,QAAQC,wBAAe,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,KAAA,EAAM,EAAwB;;AAEzE,QAAQ,MAAM,GAAA,GAAMD,kCAAsB,CAAC,KAAK,CAAC;AACjD,QAAQ,GAAG,EAAE,KAAK,CAACH,oBAAU,CAAC,OAAO,EAAE,IAAI,CAAC;AAC5C,MAAM,CAAC;AACP,IAAI,CAAC,CAAC;AACN,EAAE,CAAC,CAAC;AACJ;;;;"}
1
+ {"version":3,"file":"console.js","sources":["../../../src/instrument/console.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/ban-types */\nimport { DEBUG_BUILD } from '../debug-build';\nimport type { ConsoleLevel, HandlerDataConsole } from '../types-hoist/instrument';\nimport { CONSOLE_LEVELS, originalConsoleMethods } from '../utils/debug-logger';\nimport { fill } from '../utils/object';\nimport { stringMatchesSomePattern } from '../utils/string';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\nimport { addHandler, maybeInstrument, triggerHandlers } from './handlers';\nimport { debug } from '../utils/debug-logger';\n\n/**\n * Filter out console messages that match the given strings or regular expressions.\n * These will neither be passed to the handler, and they will also not be logged to the user, unless they have debug enabled.\n * This is a set to avoid duplicate integration setups to add the same filter multiple times.\n */\nconst _filter = new Set<string | RegExp>([]);\n\n/**\n * Add an instrumentation handler for when a console.xxx method is called.\n * Returns a function to remove the handler.\n *\n * Use at your own risk, this might break without changelog notice, only used internally.\n * @hidden\n */\nexport function addConsoleInstrumentationHandler(handler: (data: HandlerDataConsole) => void): () => void {\n const type = 'console';\n const removeHandler = addHandler(type, handler);\n maybeInstrument(type, instrumentConsole);\n return removeHandler;\n}\n\n/**\n * Add a filter to the console instrumentation to filter out console messages that match the given strings or regular expressions.\n * Returns a function to remove the filter.\n */\nexport function addConsoleInstrumentationFilter(filter: (string | RegExp)[]): () => void {\n for (const f of filter) {\n _filter.add(f);\n }\n\n return () => {\n for (const f of filter) {\n _filter.delete(f);\n }\n };\n}\n\n/** Only exported for tests. */\nexport function _INTERNAL_resetConsoleInstrumentationOptions(): void {\n _filter.clear();\n}\n\nfunction instrumentConsole(): void {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n CONSOLE_LEVELS.forEach(function (level: ConsoleLevel): void {\n if (!(level in GLOBAL_OBJ.console)) {\n return;\n }\n\n fill(GLOBAL_OBJ.console, level, function (originalConsoleMethod: () => any): Function {\n originalConsoleMethods[level] = originalConsoleMethod;\n\n return function (...args: any[]): void {\n const firstArg = args[0];\n const log = originalConsoleMethods[level];\n\n const isFiltered = _filter.size && typeof firstArg === 'string' && stringMatchesSomePattern(firstArg, _filter);\n\n // Only trigger handlers for non-filtered messages\n if (!isFiltered) {\n triggerHandlers('console', { args, level } as HandlerDataConsole);\n }\n\n // Only log filtered messages in debug mode\n if (!isFiltered || (DEBUG_BUILD && debug.isEnabled())) {\n // Call original console method\n log?.apply(GLOBAL_OBJ.console, args);\n }\n };\n });\n });\n}\n"],"names":["addHandler","maybeInstrument","GLOBAL_OBJ","CONSOLE_LEVELS","fill","originalConsoleMethods","stringMatchesSomePattern","triggerHandlers","DEBUG_BUILD","debug"],"mappings":";;;;;;;;;AAAA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA,MAAM,UAAU,IAAI,GAAG,CAAkB,EAAE,CAAC;;AAE5C;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,gCAAgC,CAAC,OAAO,EAAkD;AAC1G,EAAE,MAAM,IAAA,GAAO,SAAS;AACxB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IAAI,EAAE,KAAA,EAAM,EAAwB;AAC3E,QAAQ;;AAER;AACA,QAAQ,IAAI,CAAC,UAAA,KAAeC,sBAAA,IAAeC,iBAAK,CAAC,SAAS,EAAE,CAAC,EAAE;AAC/D;AACA,UAAU,GAAG,EAAE,KAAK,CAACP,oBAAU,CAAC,OAAO,EAAE,IAAI,CAAC;AAC9C,QAAQ;AACR,MAAM,CAAC;AACP,IAAI,CAAC,CAAC;AACN,EAAE,CAAC,CAAC;AACJ;;;;;"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const currentScopes = require('../currentScopes.js');
4
- const _exports = require('../exports.js');
4
+ const exports$1 = require('../exports.js');
5
5
  const console = require('../instrument/console.js');
6
6
  const integration = require('../integration.js');
7
7
  const debugLogger = require('../utils/debug-logger.js');
@@ -81,7 +81,7 @@ function consoleHandler(args, level, handled) {
81
81
 
82
82
  const error = args.find(arg => arg instanceof Error);
83
83
  if (error) {
84
- _exports.captureException(error, captureContext);
84
+ exports$1.captureException(error, captureContext);
85
85
  return;
86
86
  }
87
87
 
@@ -1 +1 @@
1
- {"version":3,"file":"captureconsole.js","sources":["../../../src/integrations/captureconsole.ts"],"sourcesContent":["import { getClient, withScope } from '../currentScopes';\nimport { captureException } from '../exports';\nimport { addConsoleInstrumentationHandler } from '../instrument/console';\nimport { defineIntegration } from '../integration';\nimport type { CaptureContext } from '../scope';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport { CONSOLE_LEVELS } from '../utils/debug-logger';\nimport { addExceptionMechanism } from '../utils/misc';\nimport { severityLevelFromString } from '../utils/severity';\nimport { safeJoin } from '../utils/string';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\n\ninterface CaptureConsoleOptions {\n levels?: string[];\n\n /**\n * By default, Sentry will mark captured console messages as handled.\n * Set this to `false` if you want to mark them as unhandled instead.\n *\n * @default true\n */\n handled?: boolean;\n}\n\nconst INTEGRATION_NAME = 'CaptureConsole';\n\nconst _captureConsoleIntegration = ((options: CaptureConsoleOptions = {}) => {\n const levels = options.levels || CONSOLE_LEVELS;\n const handled = options.handled ?? true;\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n addConsoleInstrumentationHandler(({ args, level }) => {\n if (getClient() !== client || !levels.includes(level)) {\n return;\n }\n\n consoleHandler(args, level, handled);\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Send Console API calls as Sentry Events.\n */\nexport const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration);\n\nfunction consoleHandler(args: unknown[], level: string, handled: boolean): void {\n const severityLevel = severityLevelFromString(level);\n\n /*\n We create this error here already to attach a stack trace to captured messages,\n if users set `attachStackTrace` to `true` in Sentry.init.\n We do this here already because we want to minimize the number of Sentry SDK stack frames\n within the error. Technically, Client.captureMessage will also do it but this happens several\n stack frames deeper.\n */\n const syntheticException = new Error();\n\n const captureContext: CaptureContext = {\n level: severityLevelFromString(level),\n extra: {\n arguments: args,\n },\n };\n\n withScope(scope => {\n scope.addEventProcessor(event => {\n event.logger = 'console';\n\n addExceptionMechanism(event, {\n handled,\n type: 'auto.core.capture_console',\n });\n\n return event;\n });\n\n if (level === 'assert') {\n if (!args[0]) {\n const message = `Assertion failed: ${safeJoin(args.slice(1), ' ') || 'console.assert'}`;\n scope.setExtra('arguments', args.slice(1));\n scope.captureMessage(message, severityLevel, { captureContext, syntheticException });\n }\n return;\n }\n\n const error = args.find(arg => arg instanceof Error);\n if (error) {\n captureException(error, captureContext);\n return;\n }\n\n const message = safeJoin(args, ' ');\n scope.captureMessage(message, severityLevel, { captureContext, syntheticException });\n });\n}\n"],"names":["CONSOLE_LEVELS","GLOBAL_OBJ","addConsoleInstrumentationHandler","getClient","defineIntegration","severityLevelFromString","withScope","addExceptionMechanism","safeJoin","captureException"],"mappings":";;;;;;;;;;;;AAwBA,MAAM,gBAAA,GAAmB,gBAAgB;;AAEzC,MA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AAqB,CAAC,KAAK,EAAE;AACnC,QAAQ,OAAO;AACf,QAAQ,IAAI,EAAE,2BAA2B;AACzC,OAAO,CAAC;;AAER,MAAM,OAAO,KAAK;AAClB,IAAI,CAAC,CAAC;;AAEN,IAAI,IAAI,KAAA,KAAU,QAAQ,EAAE;AAC5B,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;AACpB,QAAQ,MAAM,UAAU,CAAC,kBAAkB,EAAEC,eAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,gBAAgB,CAAC,CAAA;AACA,QAAA,KAAA,CAAA,QAAA,CAAA,WAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAA,CAAA,CAAA;AACA,QAAA,KAAA,CAAA,cAAA,CAAA,OAAA,EAAA,aAAA,EAAA,EAAA,cAAA,EAAA,kBAAA,EAAA,CAAA;AACA,MAAA;AACA,MAAA;AACA,IAAA;;AAEA,IAAA,MAAA,KAAA,GAAA,IAAA,CAAA,IAAA,CAAA,GAAA,IAAA,GAAA,YAAA,KAAA,CAAA;AACA,IAAA,IAAA,KAAA,EAAA;AACA,MAAAC,yBAAA,CAAA,KAAA,EAAA,cAAA,CAAA;AACA,MAAA;AACA,IAAA;;AAEA,IAAA,MAAA,OAAA,GAAAD,eAAA,CAAA,IAAA,EAAA,GAAA,CAAA;AACA,IAAA,KAAA,CAAA,cAAA,CAAA,OAAA,EAAA,aAAA,EAAA,EAAA,cAAA,EAAA,kBAAA,EAAA,CAAA;AACA,EAAA,CAAA,CAAA;AACA;;;;"}
1
+ {"version":3,"file":"captureconsole.js","sources":["../../../src/integrations/captureconsole.ts"],"sourcesContent":["import { getClient, withScope } from '../currentScopes';\nimport { captureException } from '../exports';\nimport { addConsoleInstrumentationHandler } from '../instrument/console';\nimport { defineIntegration } from '../integration';\nimport type { CaptureContext } from '../scope';\nimport type { IntegrationFn } from '../types-hoist/integration';\nimport { CONSOLE_LEVELS } from '../utils/debug-logger';\nimport { addExceptionMechanism } from '../utils/misc';\nimport { severityLevelFromString } from '../utils/severity';\nimport { safeJoin } from '../utils/string';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\n\ninterface CaptureConsoleOptions {\n levels?: string[];\n\n /**\n * By default, Sentry will mark captured console messages as handled.\n * Set this to `false` if you want to mark them as unhandled instead.\n *\n * @default true\n */\n handled?: boolean;\n}\n\nconst INTEGRATION_NAME = 'CaptureConsole';\n\nconst _captureConsoleIntegration = ((options: CaptureConsoleOptions = {}) => {\n const levels = options.levels || CONSOLE_LEVELS;\n const handled = options.handled ?? true;\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n if (!('console' in GLOBAL_OBJ)) {\n return;\n }\n\n addConsoleInstrumentationHandler(({ args, level }) => {\n if (getClient() !== client || !levels.includes(level)) {\n return;\n }\n\n consoleHandler(args, level, handled);\n });\n },\n };\n}) satisfies IntegrationFn;\n\n/**\n * Send Console API calls as Sentry Events.\n */\nexport const captureConsoleIntegration = defineIntegration(_captureConsoleIntegration);\n\nfunction consoleHandler(args: unknown[], level: string, handled: boolean): void {\n const severityLevel = severityLevelFromString(level);\n\n /*\n We create this error here already to attach a stack trace to captured messages,\n if users set `attachStackTrace` to `true` in Sentry.init.\n We do this here already because we want to minimize the number of Sentry SDK stack frames\n within the error. Technically, Client.captureMessage will also do it but this happens several\n stack frames deeper.\n */\n const syntheticException = new Error();\n\n const captureContext: CaptureContext = {\n level: severityLevelFromString(level),\n extra: {\n arguments: args,\n },\n };\n\n withScope(scope => {\n scope.addEventProcessor(event => {\n event.logger = 'console';\n\n addExceptionMechanism(event, {\n handled,\n type: 'auto.core.capture_console',\n });\n\n return event;\n });\n\n if (level === 'assert') {\n if (!args[0]) {\n const message = `Assertion failed: ${safeJoin(args.slice(1), ' ') || 'console.assert'}`;\n scope.setExtra('arguments', args.slice(1));\n scope.captureMessage(message, severityLevel, { captureContext, syntheticException });\n }\n return;\n }\n\n const error = args.find(arg => arg instanceof Error);\n if (error) {\n captureException(error, captureContext);\n return;\n }\n\n const message = safeJoin(args, ' ');\n scope.captureMessage(message, severityLevel, { captureContext, syntheticException });\n });\n}\n"],"names":["CONSOLE_LEVELS","GLOBAL_OBJ","addConsoleInstrumentationHandler","getClient","defineIntegration","severityLevelFromString","withScope","addExceptionMechanism","safeJoin","captureException"],"mappings":";;;;;;;;;;;;AAwBA,MAAM,gBAAA,GAAmB,gBAAgB;;AAEzC,MAAM,0BAAA,IAA8B,CAAC,OAAO,GAA0B,EAAE,KAAK;AAC7E,EAAE,MAAM,MAAA,GAAS,OAAO,CAAC,MAAA,IAAUA,0BAAc;AACjD,EAAE,MAAM,OAAA,GAAU,OAAO,CAAC,OAAA,IAAW,IAAI;;AAEzC,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,IAAI,EAAE,aAAaC,oBAAU,CAAC,EAAE;AACtC,QAAQ;AACR,MAAM;;AAEN,MAAMC,wCAAgC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAA,EAAO,KAAK;AAC5D,QAAQ,IAAIC,uBAAS,OAAO,MAAA,IAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;AAC/D,UAAU;AACV,QAAQ;;AAER,QAAQ,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC;AAC5C,MAAM,CAAC,CAAC;AACR,IAAI,CAAC;AACL,GAAG;AACH,CAAC,CAAA;;AAED;AACA;AACA;MACa,yBAAA,GAA4BC,6BAAiB,CAAC,0BAA0B;;AAErF,SAAS,cAAc,CAAC,IAAI,EAAa,KAAK,EAAU,OAAO,EAAiB;AAChF,EAAE,MAAM,aAAA,GAAgBC,gCAAuB,CAAC,KAAK,CAAC;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAE,MAAM,kBAAA,GAAqB,IAAI,KAAK,EAAE;;AAExC,EAAE,MAAM,cAAc,GAAmB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A,CAAA,CAAA;AACA;;;;"}
@@ -39,8 +39,12 @@ const consoleIntegration = integration.defineIntegration((options = {}) => {
39
39
 
40
40
  addConsoleBreadcrumb(level, args);
41
41
  });
42
-
43
42
  client.registerCleanup(unsubscribe);
43
+
44
+ if (options.filter) {
45
+ const unsubscribe = console.addConsoleInstrumentationFilter(options.filter);
46
+ client.registerCleanup(unsubscribe);
47
+ }
44
48
  },
45
49
  };
46
50
  });
@@ -1 +1 @@
1
- {"version":3,"file":"console.js","sources":["../../../src/integrations/console.ts"],"sourcesContent":["import { addBreadcrumb } from '../breadcrumbs';\nimport { getClient } from '../currentScopes';\nimport { addConsoleInstrumentationHandler } from '../instrument/console';\nimport { defineIntegration } from '../integration';\nimport type { ConsoleLevel } from '../types-hoist/instrument';\nimport { CONSOLE_LEVELS } from '../utils/debug-logger';\nimport { severityLevelFromString } from '../utils/severity';\nimport { safeJoin } from '../utils/string';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\n\ninterface ConsoleIntegrationOptions {\n levels: ConsoleLevel[];\n}\n\ntype GlobalObjectWithUtil = typeof GLOBAL_OBJ & {\n util: {\n format: (...args: unknown[]) => string;\n };\n};\n\nconst INTEGRATION_NAME = 'Console';\n\n/**\n * Captures calls to the `console` API as breadcrumbs in Sentry.\n *\n * By default the integration instruments `console.debug`, `console.info`, `console.warn`, `console.error`,\n * `console.log`, `console.trace`, and `console.assert`. You can use the `levels` option to customize which\n * levels are captured.\n *\n * @example\n *\n * ```js\n * Sentry.init({\n * integrations: [Sentry.consoleIntegration({ levels: ['error', 'warn'] })],\n * });\n * ```\n */\nexport const consoleIntegration = defineIntegration((options: Partial<ConsoleIntegrationOptions> = {}) => {\n const levels = new Set(options.levels || CONSOLE_LEVELS);\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const unsubscribe = addConsoleInstrumentationHandler(({ args, level }) => {\n if (getClient() !== client || !levels.has(level)) {\n return;\n }\n\n addConsoleBreadcrumb(level, args);\n });\n\n client.registerCleanup(unsubscribe);\n },\n };\n});\n\n/**\n * Capture a console breadcrumb.\n *\n * Exported just for tests.\n */\nexport function addConsoleBreadcrumb(level: ConsoleLevel, args: unknown[]): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: args,\n logger: 'console',\n },\n level: severityLevelFromString(level),\n message: formatConsoleArgs(args),\n };\n\n if (level === 'assert') {\n if (args[0] === false) {\n const assertionArgs = args.slice(1);\n breadcrumb.message =\n assertionArgs.length > 0 ? `Assertion failed: ${formatConsoleArgs(assertionArgs)}` : 'Assertion failed';\n breadcrumb.data.arguments = assertionArgs;\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n addBreadcrumb(breadcrumb, {\n input: args,\n level,\n });\n}\n\nfunction formatConsoleArgs(values: unknown[]): string {\n return 'util' in GLOBAL_OBJ && typeof (GLOBAL_OBJ as GlobalObjectWithUtil).util.format === 'function'\n ? (GLOBAL_OBJ as GlobalObjectWithUtil).util.format(...values)\n : safeJoin(values, ' ');\n}\n"],"names":["defineIntegration","CONSOLE_LEVELS","addConsoleInstrumentationHandler","getClient","severityLevelFromString","addBreadcrumb","GLOBAL_OBJ","safeJoin"],"mappings":";;;;;;;;;;;AAoBA,MAAM,gBAAA,GAAmB,SAAS;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAA,GAAqBA,6BAAiB,CAAC,CAAC,OAAO,GAAuC,EAAE,KAAK;AAC1G,EAAE,MAAM,MAAA,GAAS,IAAI,GAAG,CAAC,OAAO,CAAC,MAAA,IAAUC,0BAAc,CAAC;;AAE1D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,MAAM,WAAA,GAAcC,wCAAgC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAA,EAAO,KAAK;AAChF,QAAQ,IAAIC,uBAAS,OAAO,MAAA,IAAU,CA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AAA,KAAA;AACA,MAAA,CAAAA,oBAAA,GAAA,IAAA,CAAA,MAAA,CAAA,GAAA,MAAA;AACA,MAAAC,eAAA,CAAA,MAAA,EAAA,GAAA,CAAA;AACA;;;;;"}
1
+ {"version":3,"file":"console.js","sources":["../../../src/integrations/console.ts"],"sourcesContent":["import { addBreadcrumb } from '../breadcrumbs';\nimport { getClient } from '../currentScopes';\nimport { addConsoleInstrumentationFilter, addConsoleInstrumentationHandler } from '../instrument/console';\nimport { defineIntegration } from '../integration';\nimport type { ConsoleLevel } from '../types-hoist/instrument';\nimport { CONSOLE_LEVELS } from '../utils/debug-logger';\nimport { severityLevelFromString } from '../utils/severity';\nimport { safeJoin } from '../utils/string';\nimport { GLOBAL_OBJ } from '../utils/worldwide';\n\ninterface ConsoleIntegrationOptions {\n levels: ConsoleLevel[];\n /**\n * Filter out console messages that match the given strings or regular expressions.\n * These will neither be passed to the handler, and they will also not be logged to the user, unless they have debug enabled.\n */\n filter?: (string | RegExp)[];\n}\n\ntype GlobalObjectWithUtil = typeof GLOBAL_OBJ & {\n util: {\n format: (...args: unknown[]) => string;\n };\n};\n\nconst INTEGRATION_NAME = 'Console';\n\n/**\n * Captures calls to the `console` API as breadcrumbs in Sentry.\n *\n * By default the integration instruments `console.debug`, `console.info`, `console.warn`, `console.error`,\n * `console.log`, `console.trace`, and `console.assert`. You can use the `levels` option to customize which\n * levels are captured.\n *\n * @example\n *\n * ```js\n * Sentry.init({\n * integrations: [Sentry.consoleIntegration({ levels: ['error', 'warn'] })],\n * });\n * ```\n */\nexport const consoleIntegration = defineIntegration((options: Partial<ConsoleIntegrationOptions> = {}) => {\n const levels = new Set(options.levels || CONSOLE_LEVELS);\n\n return {\n name: INTEGRATION_NAME,\n setup(client) {\n const unsubscribe = addConsoleInstrumentationHandler(({ args, level }) => {\n if (getClient() !== client || !levels.has(level)) {\n return;\n }\n\n addConsoleBreadcrumb(level, args);\n });\n client.registerCleanup(unsubscribe);\n\n if (options.filter) {\n const unsubscribe = addConsoleInstrumentationFilter(options.filter);\n client.registerCleanup(unsubscribe);\n }\n },\n };\n});\n\n/**\n * Capture a console breadcrumb.\n *\n * Exported just for tests.\n */\nexport function addConsoleBreadcrumb(level: ConsoleLevel, args: unknown[]): void {\n const breadcrumb = {\n category: 'console',\n data: {\n arguments: args,\n logger: 'console',\n },\n level: severityLevelFromString(level),\n message: formatConsoleArgs(args),\n };\n\n if (level === 'assert') {\n if (args[0] === false) {\n const assertionArgs = args.slice(1);\n breadcrumb.message =\n assertionArgs.length > 0 ? `Assertion failed: ${formatConsoleArgs(assertionArgs)}` : 'Assertion failed';\n breadcrumb.data.arguments = assertionArgs;\n } else {\n // Don't capture a breadcrumb for passed assertions\n return;\n }\n }\n\n addBreadcrumb(breadcrumb, {\n input: args,\n level,\n });\n}\n\nfunction formatConsoleArgs(values: unknown[]): string {\n return 'util' in GLOBAL_OBJ && typeof (GLOBAL_OBJ as GlobalObjectWithUtil).util.format === 'function'\n ? (GLOBAL_OBJ as GlobalObjectWithUtil).util.format(...values)\n : safeJoin(values, ' ');\n}\n"],"names":["defineIntegration","CONSOLE_LEVELS","addConsoleInstrumentationHandler","getClient","addConsoleInstrumentationFilter","severityLevelFromString","addBreadcrumb","GLOBAL_OBJ","safeJoin"],"mappings":";;;;;;;;;;;AAyBA,MAAM,gBAAA,GAAmB,SAAS;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,kBAAA,GAAqBA,6BAAiB,CAAC,CAAC,OAAO,GAAuC,EAAE,KAAK;AAC1G,EAAE,MAAM,MAAA,GAAS,IAAI,GAAG,CAAC,OAAO,CAAC,MAAA,IAAUC,0BAAc,CAAC;;AAE1D,EAAE,OAAO;AACT,IAAI,IAAI,EAAE,gBAAgB;AAC1B,IAAI,KAAK,CAAC,MAAM,EAAE;AAClB,MAAM,MAAM,WAAA,GAAcC,wCAAgC,CAAC,CAAC,EAAE,IAAI,EAAE,KAA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EAAA;;AAEA,EAAAC,yBAAA,CAAA,UAAA,EAAA;AACA,IAAA,KAAA,EAAA,IAAA;AACA,IAAA,KAAA;AACA,GAAA,CAAA;AACA;;AAEA,SAAA,iBAAA,CAAA,MAAA,EAAA;AACA,EAAA,OAAA,MAAA,IAAAC,oBAAA,IAAA,OAAA,CAAAA,oBAAA,GAAA,IAAA,CAAA,MAAA,KAAA;AACA,MAAA,CAAAA,oBAAA,GAAA,IAAA,CAAA,MAAA,CAAA,GAAA,MAAA;AACA,MAAAC,eAAA,CAAA,MAAA,EAAA,GAAA,CAAA;AACA;;;;;"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const debugLogger = require('../../utils/debug-logger.js');
4
- const _exports = require('../../exports.js');
4
+ const exports$1 = require('../../exports.js');
5
5
  const debugBuild = require('../../debug-build.js');
6
6
  const utils = require('./utils.js');
7
7
  const object = require('../../utils/object.js');
@@ -182,7 +182,7 @@ function expressErrorHandler(options) {
182
182
  const shouldHandleError = options?.shouldHandleError || utils.defaultShouldHandleError;
183
183
 
184
184
  if (shouldHandleError(error)) {
185
- const eventId = _exports.captureException(error, {
185
+ const eventId = exports$1.captureException(error, {
186
186
  mechanism: { type: 'auto.middleware.express', handled: false },
187
187
  });
188
188
  (res ).sentry = eventId;
@@ -1 +1 @@
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 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","getDefaultExport","isExpressWithRouterPrototype","isExpressWithoutRouterPrototype","wrapMethod","patchLayer","getLayerPath","setSDKProcessingMetadata","defaultShouldHandleError","captureException"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AA+BA,SAAS,eAAe;AACxB,EAAE,OAAO;AACT,EAA2E;AAC3E,EAAE,OAAO,CAAC,CAAC,CAAC,OAAA,GAA6C,OAAO;AAChE;;AAEA;AACA,IAAI,2BAAA,GAA8B,KAAK;AACvC,SAAS,kBAAkB,GAAG;AAC9B,EAAE,IAAI,CAAC,2BAA2B,EAAE;AACpC,IAAI,2BAAA,GAA8B,IAAI;AACtC,IAAIA,sBAAA;AACJ,MAAMC,iBAAK,CAAC,IAAI;AAChB,QAAQ,qHAAqH;AAC7H,OAAO;AACP,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWO,SAAS,kBAAkB;AAClC,EAAE,gBAAgB;AAClB,EAAE,eAAe;AACjB,EAAuB;AACvB,EAAE,IAAI,UAAU;AAChB,EAAE,IAAI,aAAa;AACnB,EAAE,IAAI,CAAC,eAAA,IAAmB,eAAe,CAAC,gBAAgB,CAAC,EAAE;AAC7D,IAA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A;AACA;AACA;AACO,SAAS,wBAAwB;AACxC,EAAE;;AAGA;AACF,EAAE,OAAO;AACT,EAAQ;AACR,EAAE,GAAG,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;AAClC,EAAE,GAAG,CAAC,GAAG,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC;AACvC;;AAEA,SAAS,qBAAqB,GAAsB;AACpD,EAAE,OAAO,SAAS,uBAAuB,CAAC,OAAO,EAAkB,IAAI,EAAmB,IAAI,EAAoB;AAClH,IAAIF,iDAAwB,CAAC,OAAO,CAAC;AACrC,IAAI,IAAI,EAAE;AACV,EAAE,CAAC;AACH;;;;;;"}
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 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","getDefaultExport","isExpressWithRouterPrototype","isExpressWithoutRouterPrototype","wrapMethod","patchLayer","getLayerPath","setSDKProcessingMetadata","defaultShouldHandleError","captureException"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AA+BA,SAAS,eAAe;AACxB,EAAE,OAAO;AACT,EAA2E;AAC3E,EAAE,OAAO,CAAC,CAAC,CAAC,OAAA,GAA6C,OAAO;AAChE;;AAEA;AACA,IAAI,2BAAA,GAA8B,KAAK;AACvC,SAAS,kBAAkB,GAAG;AAC9B,EAAE,IAAI,CAAC,2BAA2B,EAAE;AACpC,IAAI,2BAAA,GAA8B,IAAI;AACtC,IAAIA,sBAAA;AACJ,MAAMC,iBAAK,CAAC,IAAI;AAChB,QAAQ,qHAAqH;AAC7H,OAAO;AACP,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWO,SAAS,kBAAkB;AAClC,EAAE,gBAAgB;AAClB,EAAE,eAAe;AACjB,EAAuB;AACvB,EAAE,IAAI,UAAU;AAChB,EAAE,IAAI,aAAa;AACnB,EAAE,IAAI,CAAC,eAAA,IAAmB,eAAe,CAAC,gBAAgB,CAAC,EAAE;AAC7D,IAAI,MAAM,EAAE,OAAO,EAAE,GAAG,OAAA,EAAQ,GAAI,gBAAgB;AACpD,IAAI,aAAA,GAAgB,OAAO;AAC3B,IAAI,UAAA,GAAa,MAAM,OAAO;AAC9B,IAAI,kBAAkB,EAAE;AACxB,EAAE,CAAA,MAAO,IAAI,OAAO,eAAA,KAAoB,UAAU,EAAE;AACpD,IAAI,MAAM,IAAI,SAAS,CAAC,kFAAkF,CAAC;AAC3G,EAAE,OAAO;AACT,IAAI,UAAA,GAAa,eAAe;AAChC,IAAI,aAAA,GAAgB,gBAAA;AACpB,EAAE;;AAEF;AACA,EAAE,MAAM,OAAA,GAAUC,iCAAgB,CAAC,aAAa,CAAC;AACjD,EAAE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  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
3
  const currentScopes = require('../../currentScopes.js');
4
- const _exports = require('../../exports.js');
4
+ const exports$1 = require('../../exports.js');
5
5
  const spanUtils = require('../../utils/spanUtils.js');
6
6
  const spanstatus = require('../../tracing/spanstatus.js');
7
7
 
@@ -36,7 +36,7 @@ function captureError(error, errorType, extraData) {
36
36
  });
37
37
  }
38
38
 
39
- _exports.captureException(error, {
39
+ exports$1.captureException(error, {
40
40
  mechanism: {
41
41
  type: 'auto.ai.mcp_server',
42
42
  handled: false,
@@ -1 +1 @@
1
- {"version":3,"file":"errorCapture.js","sources":["../../../../src/integrations/mcp-server/errorCapture.ts"],"sourcesContent":["/**\n * Safe error capture utilities for MCP server instrumentation\n *\n * Ensures error reporting never interferes with MCP server operation.\n * All capture operations are wrapped in try-catch to prevent side effects.\n */\n\nimport { getClient } from '../../currentScopes';\nimport { captureException } from '../../exports';\nimport { SPAN_STATUS_ERROR } from '../../tracing';\nimport { getActiveSpan } from '../../utils/spanUtils';\nimport type { McpErrorType } from './types';\n\n/**\n * Captures an error without affecting MCP server operation.\n *\n * The active span already contains all MCP context (method, tool, arguments, etc.)\n * @param error - Error to capture\n * @param errorType - Classification of error type for filtering\n * @param extraData - Additional context data to include\n */\nexport function captureError(error: Error, errorType?: McpErrorType, extraData?: Record<string, unknown>): void {\n try {\n const client = getClient();\n if (!client) {\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (activeSpan?.isRecording()) {\n activeSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: 'internal_error',\n });\n }\n\n captureException(error, {\n mechanism: {\n type: 'auto.ai.mcp_server',\n handled: false,\n data: {\n error_type: errorType || 'handler_execution',\n ...extraData,\n },\n },\n });\n } catch {\n // noop\n }\n}\n"],"names":["getClient","getActiveSpan","SPAN_STATUS_ERROR","captureException"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAY,CAAC,KAAK,EAAS,SAAS,EAAiB,SAAS,EAAkC;AAChH,EAAE,IAAI;AACN,IAAI,MAAM,MAAA,GAASA,uBAAS,EAAE;AAC9B,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,UAAA,GAAaC,uBAAa,EAAE;AACtC,IAAI,IAAI,UAAU,EAAE,WAAW,EAAE,EAAE;AACnC,MAAM,UAAU,CAAC,SAAS,CAAC;AAC3B,QAAQ,IAAI,EAAEC,4BAAiB;AAC/B,QAAQ,OAAO,EAAE,gBAAgB;AACjC,OAAO,CAAC;AACR,IAAI;;AAEJ,IAAIC,yBAAgB,CAAC,KAAK,EAAE;AAC5B,MAAM,SAAS,EAAE;AACjB,QAAQ,IAAI,EAAE,oBAAoB;AAClC,QAAQ,OAAO,EAAE,KAAK;AACtB,QAAQ,IAAI,EAAE;AACd,UAAU,UAAU,EAAE,SAAA,IAAa,mBAAmB;AACtD,UAAU,GAAG,SAAS;AACtB,SAAS;AACT,OAAO;AACP,KAAK,CAAC;AACN,EAAE,EAAE,MAAM;AACV;AACA,EAAE;AACF;;;;"}
1
+ {"version":3,"file":"errorCapture.js","sources":["../../../../src/integrations/mcp-server/errorCapture.ts"],"sourcesContent":["/**\n * Safe error capture utilities for MCP server instrumentation\n *\n * Ensures error reporting never interferes with MCP server operation.\n * All capture operations are wrapped in try-catch to prevent side effects.\n */\n\nimport { getClient } from '../../currentScopes';\nimport { captureException } from '../../exports';\nimport { SPAN_STATUS_ERROR } from '../../tracing';\nimport { getActiveSpan } from '../../utils/spanUtils';\nimport type { McpErrorType } from './types';\n\n/**\n * Captures an error without affecting MCP server operation.\n *\n * The active span already contains all MCP context (method, tool, arguments, etc.)\n * @param error - Error to capture\n * @param errorType - Classification of error type for filtering\n * @param extraData - Additional context data to include\n */\nexport function captureError(error: Error, errorType?: McpErrorType, extraData?: Record<string, unknown>): void {\n try {\n const client = getClient();\n if (!client) {\n return;\n }\n\n const activeSpan = getActiveSpan();\n if (activeSpan?.isRecording()) {\n activeSpan.setStatus({\n code: SPAN_STATUS_ERROR,\n message: 'internal_error',\n });\n }\n\n captureException(error, {\n mechanism: {\n type: 'auto.ai.mcp_server',\n handled: false,\n data: {\n error_type: errorType || 'handler_execution',\n ...extraData,\n },\n },\n });\n } catch {\n // noop\n }\n}\n"],"names":["getClient","getActiveSpan","SPAN_STATUS_ERROR","captureException"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,YAAY,CAAC,KAAK,EAAS,SAAS,EAAiB,SAAS,EAAkC;AAChH,EAAE,IAAI;AACN,IAAI,MAAM,MAAA,GAASA,uBAAS,EAAE;AAC9B,IAAI,IAAI,CAAC,MAAM,EAAE;AACjB,MAAM;AACN,IAAI;;AAEJ,IAAI,MAAM,UAAA,GAAaC,uBAAa,EAAE;AACtC,IAAI,IAAI,UAAU,EAAE,WAAW,EAAE,EAAE;AACnC,MAAM,UAAU,CAAC,SAAS,CAAC;AAC3B,QAAQ,IAAI,EAAEC,4BAAiB;AAC/B,QAAQ,OAAO,EAAE,gBAAgB;AACjC,OAAO,CAAC;AACR,IAAI;;AAEJ,IAAIC,0BAAgB,CAAC,KAAK,EAAE;AAC5B,MAAM,SAAS,EAAE;AACjB,QAAQ,IAAI,EAAE,oBAAoB;AAClC,QAAQ,OAAO,EAAE,KAAK;AACtB,QAAQ,IAAI,EAAE;AACd,UAAU,UAAU,EAAE,SAAA,IAAa,mBAAmB;AACtD,UAAU,GAAG,SAAS;AACtB,SAAS;AACT,OAAO;AACP,KAAK,CAAC;AACN,EAAE,EAAE,MAAM;AACV;AACA,EAAE;AACF;;;;"}