@sentry/server-utils 11.17.0 → 11.18.0

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 (95) hide show
  1. package/build/cjs/chunks/config.js +2 -2
  2. package/build/cjs/chunks/config.js.map +1 -1
  3. package/build/cjs/chunks/exports.js +115 -10
  4. package/build/cjs/chunks/exports.js.map +1 -1
  5. package/build/cjs/index.js +148 -31
  6. package/build/cjs/index.js.map +1 -1
  7. package/build/cjs/index.no-diagnostic-channels.js +1 -0
  8. package/build/cjs/index.request-handler.js +48 -3
  9. package/build/cjs/index.request-handler.js.map +1 -1
  10. package/build/esm/ai/langchain/utils.js +1 -5
  11. package/build/esm/ai/langchain/utils.js.map +1 -1
  12. package/build/esm/ai/mistral/streaming.js.map +1 -1
  13. package/build/esm/exports.js +2 -1
  14. package/build/esm/index.js +3 -1
  15. package/build/esm/index.js.map +1 -1
  16. package/build/esm/index.no-diagnostic-channels.js +2 -1
  17. package/build/esm/index.request-handler.js +3 -1
  18. package/build/esm/integrations/amqplib.js.map +1 -1
  19. package/build/esm/integrations/anthropic.js.map +1 -1
  20. package/build/esm/integrations/bullmq/tracer.js.map +1 -1
  21. package/build/esm/integrations/graphql/utils.js.map +1 -1
  22. package/build/esm/integrations/hapi/hapi-utils.js +6 -9
  23. package/build/esm/integrations/hapi/hapi-utils.js.map +1 -1
  24. package/build/esm/integrations/hono/isMiddleware.js.map +1 -1
  25. package/build/esm/integrations/hono/middlewareHandlers.js +3 -1
  26. package/build/esm/integrations/hono/middlewareHandlers.js.map +1 -1
  27. package/build/esm/integrations/hono/patchRoute.js +2 -1
  28. package/build/esm/integrations/hono/patchRoute.js.map +1 -1
  29. package/build/esm/integrations/hono/unwrapThrownValue.js +20 -0
  30. package/build/esm/integrations/hono/unwrapThrownValue.js.map +1 -0
  31. package/build/esm/integrations/mongodb/mongodb-span.js +7 -9
  32. package/build/esm/integrations/mongodb/mongodb-span.js.map +1 -1
  33. package/build/esm/integrations/pino.js +2 -2
  34. package/build/esm/integrations/pino.js.map +1 -1
  35. package/build/esm/integrations/prisma/tracing-helper.js.map +1 -1
  36. package/build/esm/integrations/serveTunnel.js +2 -2
  37. package/build/esm/integrations/serveTunnel.js.map +1 -1
  38. package/build/esm/integrations/vercel-ai/extract.js +88 -0
  39. package/build/esm/integrations/vercel-ai/extract.js.map +1 -0
  40. package/build/esm/integrations/vercel-ai/util.js +5 -1
  41. package/build/esm/integrations/vercel-ai/util.js.map +1 -1
  42. package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js +19 -9
  43. package/build/esm/integrations/vercel-ai/vercel-ai-dc-subscriber.js.map +1 -1
  44. package/build/esm/integrations/winston.js +2 -2
  45. package/build/esm/integrations/winston.js.map +1 -1
  46. package/build/esm/orchestrion/config/hono.js +2 -2
  47. package/build/esm/orchestrion/config/hono.js.map +1 -1
  48. package/build/esm/package.json +1 -1
  49. package/build/esm/utils/installedModules.js +87 -0
  50. package/build/esm/utils/installedModules.js.map +1 -0
  51. package/build/esm/utils/module.js +29 -0
  52. package/build/esm/utils/module.js.map +1 -0
  53. package/build/esm/utils/serverTimingTraceHeader.js +49 -0
  54. package/build/esm/utils/serverTimingTraceHeader.js.map +1 -0
  55. package/build/esm/utils/sql.js +4 -3
  56. package/build/esm/utils/sql.js.map +1 -1
  57. package/build/esm/utils/tunnelServer.js +3 -3
  58. package/build/esm/utils/tunnelServer.js.map +1 -1
  59. package/build/esm/utils/wrapServerRequestHandler.js +5 -4
  60. package/build/esm/utils/wrapServerRequestHandler.js.map +1 -1
  61. package/build/types/ai/langchain/utils.d.ts.map +1 -1
  62. package/build/types/ai/mistral/streaming.d.ts.map +1 -1
  63. package/build/types/exports.d.ts +1 -0
  64. package/build/types/exports.d.ts.map +1 -1
  65. package/build/types/index.d.ts +3 -2
  66. package/build/types/index.d.ts.map +1 -1
  67. package/build/types/index.request-handler.d.ts +1 -0
  68. package/build/types/index.request-handler.d.ts.map +1 -1
  69. package/build/types/integrations/amqplib.d.ts.map +1 -1
  70. package/build/types/integrations/anthropic.d.ts.map +1 -1
  71. package/build/types/integrations/bullmq/tracer.d.ts.map +1 -1
  72. package/build/types/integrations/hapi/hapi-utils.d.ts.map +1 -1
  73. package/build/types/integrations/hono/isMiddleware.d.ts.map +1 -1
  74. package/build/types/integrations/hono/middlewareHandlers.d.ts.map +1 -1
  75. package/build/types/integrations/hono/patchRoute.d.ts.map +1 -1
  76. package/build/types/integrations/hono/unwrapThrownValue.d.ts +10 -0
  77. package/build/types/integrations/hono/unwrapThrownValue.d.ts.map +1 -0
  78. package/build/types/integrations/mongodb/mongodb-span.d.ts.map +1 -1
  79. package/build/types/integrations/prisma/tracing-helper.d.ts.map +1 -1
  80. package/build/types/integrations/vercel-ai/extract.d.ts +27 -0
  81. package/build/types/integrations/vercel-ai/extract.d.ts.map +1 -0
  82. package/build/types/integrations/vercel-ai/util.d.ts +2 -0
  83. package/build/types/integrations/vercel-ai/util.d.ts.map +1 -1
  84. package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts +1 -1
  85. package/build/types/integrations/vercel-ai/vercel-ai-dc-subscriber.d.ts.map +1 -1
  86. package/build/types/utils/installedModules.d.ts +17 -0
  87. package/build/types/utils/installedModules.d.ts.map +1 -0
  88. package/build/types/utils/module.d.ts +3 -0
  89. package/build/types/utils/module.d.ts.map +1 -0
  90. package/build/types/utils/serverTimingTraceHeader.d.ts +18 -0
  91. package/build/types/utils/serverTimingTraceHeader.d.ts.map +1 -0
  92. package/build/types/utils/sql.d.ts.map +1 -1
  93. package/build/types/utils/tunnelServer.d.ts.map +1 -1
  94. package/build/types/utils/wrapServerRequestHandler.d.ts.map +1 -1
  95. package/package.json +4 -4
@@ -91,8 +91,9 @@ function extractTableNames(sql) {
91
91
  TOKEN_RE.lastIndex = 0;
92
92
  let match;
93
93
  while ((match = TOKEN_RE.exec(sql)) !== null) {
94
- if (match[1] || match[2]) {
95
- tables.push(match[1] || match[2]);
94
+ const table = match[1] || match[2];
95
+ if (table) {
96
+ tables.push(table);
96
97
  continue;
97
98
  }
98
99
  const rest = sql.slice(match.index + match[0].length);
@@ -199,7 +200,7 @@ function stripLiteralsAndComments(sql, dialect) {
199
200
  const out = [];
200
201
  let i = 0;
201
202
  while (i < sql.length) {
202
- const char = sql[i];
203
+ const char = sql.charAt(i);
203
204
  const next = sql[i + 1];
204
205
  if (char === "-" && next === "-" || (isMysql || rules.hashComments) && char === "#") {
205
206
  const lineEnd = sql.indexOf("\n", i);
@@ -1 +1 @@
1
- {"version":3,"file":"sql.js","names":[],"sources":["../../../src/utils/sql.ts"],"sourcesContent":["/* eslint-disable max-lines */\nimport {\n DB_NAMESPACE,\n DB_OPERATION_NAME,\n DB_QUERY_SUMMARY,\n DB_QUERY_TEXT,\n DB_SYSTEM_NAME,\n} from '@sentry/conventions/attributes';\nimport type { SpanAttributes } from '@sentry/core';\nimport { getClient, hasSpanStreamingEnabled } from '@sentry/core';\n\nconst MAX_SUMMARY_LENGTH = 255;\n\n// A single identifier: quoted (`\"...\"`, `'...'`, or MySQL backticks) or bare. The quoted forms have\n// to be matched as a unit, otherwise an identifier containing a space or a dot is cut in half.\nconst IDENTIFIER = '(?:\"[^\"]*\"|\\'[^\\']*\\'|`[^`]*`|[^\\\\s(,;).\\'\"`]+)';\n\n// A table reference can be schema-qualified (`\"public\".\"User\"`, `db.schema.table`), with each part\n// quoted independently. The whole qualified name is the summary target, since the schema is what\n// distinguishes two same-named tables.\nconst TABLE_NAME = `${IDENTIFIER}(?:\\\\.${IDENTIFIER})*`;\n\nconst DDL_RE = new RegExp(\n `^\\\\s*(?<operation>(?:CREATE|DROP)\\\\s+(?:TABLE|INDEX)|ALTER\\\\s+TABLE)(?:\\\\s+IF\\\\s+(?:NOT\\\\s+)?EXISTS)?\\\\s+(?<table>${TABLE_NAME})`,\n 'i',\n);\n\n// SQLite upserts insert an optional conflict clause between operation and INTO\n// (`INSERT OR REPLACE INTO`, https://sqlite.org/lang_insert.html), with `REPLACE INTO` as the\n// standalone shorthand. The clause is filler like INTO — stripping it keeps upserts on the same\n// low-cardinality summary as plain inserts.\nconst INSERT_RE = new RegExp(\n `^\\\\s*(?<operation>INSERT|REPLACE)(?:\\\\s+OR\\\\s+(?:ROLLBACK|ABORT|FAIL|IGNORE|REPLACE))?\\\\s+INTO(?:\\\\s+TABLE)?\\\\s+(?<table>${TABLE_NAME})`,\n 'i',\n);\nconst UPDATE_RE = new RegExp(\n `^\\\\s*(?<operation>UPDATE)(?:\\\\s+OR\\\\s+(?:ROLLBACK|ABORT|FAIL|IGNORE|REPLACE))?\\\\s+(?<table>${TABLE_NAME})`,\n 'i',\n);\nconst DELETE_RE = new RegExp(`^\\\\s*(?<operation>DELETE)\\\\s+FROM\\\\s+(?<table>${TABLE_NAME})`, 'i');\n\nconst SELECT_RE = /^\\s*(?:\\(\\s*)?(?<operation>SELECT)\\b/i;\n\nconst PRAGMA_RE = /^\\s*(?<operation>PRAGMA)\\s+(?<command>\\S+)/i;\n\nconst TOKEN_RE = /\\b(?:FROM|JOIN)\\s+|\\(\\s*(SELECT)\\b|\\b(?:UNION|INTERSECT|EXCEPT|MINUS)\\s+(?:ALL\\s+)?(SELECT)\\b/gi;\nconst TABLE_REF_RE = new RegExp(`^${TABLE_NAME}`);\nconst COMMA_TABLE_RE = new RegExp(`^\\\\s*,\\\\s*(${TABLE_NAME})`);\nconst SUBQUERY_SELECT_RE = /^\\(\\s*(SELECT)\\b/i;\n\n/**\n * Derives a low-cardinality summary from a SQL query for use as `db.query.summary`.\n *\n * Conforms to the OTEL semantic convention for generating query summaries:\n * - Preserves original case of operations and identifiers (no normalization)\n * - Uses format: `{operation} {target1} {target2} ...`\n * - Strips filler words (INTO, FROM) from the operation\n * - Captures multiple table targets (JOINs)\n * - Handles INSERT...SELECT with both targets\n * - Truncates to 255 characters without splitting mid-value\n *\n * @see https://opentelemetry.io/docs/specs/semconv/database/database-spans/#generating-a-summary-of-the-query\n */\nexport function getSqlQuerySummary(query: string | undefined): string | undefined {\n if (!query) {\n return undefined;\n }\n\n const pragmaMatch = PRAGMA_RE.exec(query);\n if (pragmaMatch?.groups?.['operation'] && pragmaMatch.groups['command']) {\n const operation = pragmaMatch.groups['operation'];\n const command = pragmaMatch.groups['command'];\n const parenIdx = command.indexOf('(');\n return truncate(`${operation} ${parenIdx >= 0 ? command.substring(0, parenIdx) : command}`);\n }\n\n const ddlMatch = DDL_RE.exec(query);\n if (ddlMatch?.groups?.['operation'] && ddlMatch.groups['table']) {\n return truncate(`${ddlMatch.groups['operation']} ${ddlMatch.groups['table']}`);\n }\n\n const insertMatch = INSERT_RE.exec(query);\n if (insertMatch?.groups?.['operation'] && insertMatch.groups['table']) {\n const parts = [insertMatch.groups['operation'], insertMatch.groups['table']];\n const rest = query.slice(insertMatch[0].length);\n const subSelect = /\\b(SELECT)\\b/i.exec(rest);\n if (subSelect?.[1]) {\n parts.push(subSelect[1]);\n const selectTables = extractTableNames(rest.slice(subSelect.index));\n parts.push(...selectTables);\n }\n return truncate(parts.join(' '));\n }\n\n const updateMatch = UPDATE_RE.exec(query);\n if (updateMatch?.groups?.['operation'] && updateMatch.groups['table']) {\n return truncate(`${updateMatch.groups['operation']} ${updateMatch.groups['table']}`);\n }\n\n const deleteMatch = DELETE_RE.exec(query);\n if (deleteMatch?.groups?.['operation'] && deleteMatch.groups['table']) {\n return truncate(`${deleteMatch.groups['operation']} ${deleteMatch.groups['table']}`);\n }\n\n const selectMatch = SELECT_RE.exec(query);\n if (selectMatch?.groups?.['operation']) {\n const tables = extractTableNames(query.slice(selectMatch[0].length));\n if (tables.length > 0) {\n return truncate(`${selectMatch.groups['operation']} ${tables.join(' ')}`);\n }\n return selectMatch.groups['operation'];\n }\n\n return truncate(query.trim().split(/\\s+/)[0] ?? query);\n}\n\nconst LEADING_KEYWORD_RE = /^\\s*(?:\\(\\s*)*([A-Za-z]+)\\b/;\nconst CTE_MAIN_STATEMENT_RE = /\\(|\\)|\\b(SELECT|INSERT|UPDATE|DELETE|MERGE|VALUES|TABLE)\\b/gi;\n\n/**\n * Derives `db.operation.name` from a SQL query: the first operation keyword, in its original case.\n *\n * @see https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/#db-operation-name\n */\nexport function getSqlOperationName(query: string | undefined): string | undefined {\n const match = query ? LEADING_KEYWORD_RE.exec(query) : null;\n const keyword = match?.[1];\n if (!query || !match || !keyword) {\n return undefined;\n }\n // Scanned from after `WITH`, so parentheses wrapping the whole query don't shift the depth.\n return keyword.toUpperCase() === 'WITH' ? getCteMainOperationName(query.slice(match[0].length)) : keyword;\n}\n\n/**\n * The operation of a `WITH` query is its main statement: the first operation keyword outside the\n * CTE bodies, which are all parenthesized. Counting parentheses is safe on a sanitized query, which\n * has no literals or comments left.\n */\nfunction getCteMainOperationName(query: string): string | undefined {\n let depth = 0;\n for (const match of query.matchAll(CTE_MAIN_STATEMENT_RE)) {\n if (match[0] === '(') {\n depth++;\n } else if (match[0] === ')') {\n depth--;\n } else if (depth === 0) {\n return match[1];\n }\n }\n return undefined;\n}\n\nfunction extractTableNames(sql: string): string[] {\n const tables: string[] = [];\n TOKEN_RE.lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = TOKEN_RE.exec(sql)) !== null) {\n if (match[1] || match[2]) {\n tables.push((match[1] || match[2])!);\n continue;\n }\n\n const rest = sql.slice(match.index + match[0].length);\n\n const subqueryMatch = SUBQUERY_SELECT_RE.exec(rest);\n if (subqueryMatch?.[1]) {\n tables.push(subqueryMatch[1]);\n TOKEN_RE.lastIndex = match.index + match[0].length + subqueryMatch[0].length;\n continue;\n }\n\n const tableMatch = TABLE_REF_RE.exec(rest);\n if (!tableMatch) continue;\n tables.push(tableMatch[0]);\n\n let afterTable = rest.slice(tableMatch[0].length);\n let commaMatch: RegExpExecArray | null;\n while ((commaMatch = COMMA_TABLE_RE.exec(afterTable)) !== null) {\n if (!commaMatch[1]) break;\n tables.push(commaMatch[1]);\n afterTable = afterTable.slice(commaMatch[0].length);\n }\n }\n\n return tables;\n}\n\nfunction truncate(summary: string): string {\n if (summary.length <= MAX_SUMMARY_LENGTH) {\n return summary;\n }\n const truncated = summary.substring(0, MAX_SUMMARY_LENGTH);\n const lastSpace = truncated.lastIndexOf(' ');\n return lastSpace > 0 ? truncated.substring(0, lastSpace) : truncated;\n}\n\nlet integerLiteralRE: RegExp | undefined;\nlet mssqlIntegerLiteralRE: RegExp | undefined;\n\n/**\n * The lookbehind keeps `$n` and `?n` parameter placeholders out of the match. T-SQL has neither,\n * and `$1000` there is a money literal, so `$` only guards a placeholder outside `mssql`.\n *\n * Lazy init: constructing a lookbehind at module scope evaluates it on import and crashes\n * Safari <16.4 browser bundles that reach this file via the core barrel.\n */\nfunction getIntegerLiteralRE(dialect: SqlDialect | SqlLexerRules): RegExp {\n if (dialect === 'mssql') {\n if (!mssqlIntegerLiteralRE) {\n mssqlIntegerLiteralRE = new RegExp('(?<!\\\\?)-?\\\\b\\\\d+\\\\b', 'g');\n }\n return mssqlIntegerLiteralRE;\n }\n if (!integerLiteralRE) {\n integerLiteralRE = new RegExp('(?<![$?])-?\\\\b\\\\d+\\\\b', 'g');\n }\n return integerLiteralRE;\n}\n\n/**\n * SQL dialect variants that matter for finding the end of a string literal:\n * - `standard` (PostgreSQL, SQLite): `\"` quotes identifiers, `''` is the only in-string escape,\n * and PostgreSQL's `$$…$$` dollar quoting opens a literal.\n * - `mysql`: `\"` quotes a string literal unless `ANSI_QUOTES` is set, and `\\` escapes the next\n * character unless `NO_BACKSLASH_ESCAPES` is set. Both default to off, and mysql/mysql2 escape\n * inlined values with backslashes, so this is the mode their statements arrive in.\n * - `mssql`: `[...]` quotes an identifier, so a `'` inside one is part of the name. `\"` quotes\n * one too, unless the connection sets `QUOTED_IDENTIFIER OFF`, which tedious leaves on.\n *\n * An engine with other rules passes {@link SqlLexerRules} instead.\n */\nexport type SqlDialect = 'standard' | 'mysql' | 'mssql';\n\n/**\n * Lexer rules for an engine that no {@link SqlDialect} covers. They apply on top of `standard`. The\n * integration of that engine defines them, so a bundle without that integration does not contain them.\n */\nexport interface SqlLexerRules {\n /** Whether `#` starts a line comment. */\n hashComments?: boolean;\n /** Whether a block comment can contain other block comments. */\n nestedComments?: boolean;\n /** Whether `\\` escapes the next character in a string literal or a quoted identifier. */\n backslashEscapes?: boolean;\n /** Sticky pattern for the opening tag of a dollar-quoted literal. Defaults to the PostgreSQL tag. */\n dollarQuote?: RegExp;\n /** Returns the length of the engine-specific literal at `start`, which the lexer replaces with `?`. */\n matchLiteral?: (sql: string, start: number) => number;\n /**\n * Returns true when inline data starts at `start`. The lexer drops the query text from `start` to the\n * end, because data cannot be sanitized as SQL. `out` holds the sanitized text before `start`.\n */\n isInlineData?: (sql: string, start: number, out: string[]) => boolean;\n}\n\n/**\n * Maps a driver or `db.system.name` value to the dialect its statements are written in. Callers\n * report different spellings for one engine: knex uses the driver name, Prisma the provider name,\n * and OTel the semantic-convention name. An engine we do not know about is lexed as `standard`.\n */\nexport function toSqlDialect(system: unknown): SqlDialect {\n if (system === 'mysql' || system === 'mysql2' || system === 'mariadb') {\n return 'mysql';\n }\n if (system === 'mssql' || system === 'sqlserver' || system === 'microsoft.sql_server') {\n return 'mssql';\n }\n return 'standard';\n}\n\nconst NO_RULES: SqlLexerRules = {};\n\n// Sticky, so the scanner can test one position without slicing the query on every `$`.\nconst DOLLAR_QUOTE_RE = /\\$(?:[A-Za-z_]\\w*)?\\$/y;\n\n/**\n * Returns the index just past the run's closing `delimiter`, or -1 if the run never closes. The\n * caller cannot derive that from the index alone: a query ending in `[a]]` consumed a doubled\n * delimiter, not a closing one.\n *\n * A doubled delimiter (`''`) escapes itself in every dialect; backslash escapes are dialect- and\n * context-dependent, so the caller decides.\n */\nfunction findQuotedRunEnd(sql: string, start: number, delimiter: string, backslashEscapes: boolean): number {\n for (let i = start + 1; i < sql.length; i++) {\n const char = sql[i];\n if (backslashEscapes && char === '\\\\') {\n i++;\n } else if (char === delimiter) {\n if (sql[i + 1] !== delimiter) {\n return i + 1;\n }\n i++;\n }\n }\n return -1;\n}\n\n// An unterminated comment consumes the rest of the query.\nfunction findBlockCommentEnd(sql: string, start: number, nested: boolean): number {\n let depth = 1;\n let i = start + 2;\n while (i < sql.length && depth > 0) {\n if (sql[i] === '*' && sql[i + 1] === '/') {\n depth--;\n i += 2;\n } else if (nested && sql[i] === '/' && sql[i + 1] === '*') {\n depth++;\n i += 2;\n } else {\n i++;\n }\n }\n return i;\n}\n\n/**\n * Replaces every string literal with `?` and drops every comment, in one pass.\n *\n * Doing this by scanning rather than by regex is what keeps quote state and comment state from\n * being decided independently: a regex for `'...'` cannot see that the quote it stopped at was\n * backslash-escaped, and a regex for `--...` cannot see that the `--` sits inside a literal. Both\n * mistakes end with user data surviving into `db.query.text` and `db.query.summary`.\n *\n * Quoted identifiers are preserved — they are the table and column names the query summary is\n * built from.\n */\nfunction stripLiteralsAndComments(sql: string, dialect: SqlDialect | SqlLexerRules): string {\n const [base, rules]: [SqlDialect, SqlLexerRules] =\n typeof dialect === 'string' ? [dialect, NO_RULES] : ['standard', dialect];\n const isMysql = base === 'mysql';\n const backslashEscapes = !!rules.backslashEscapes;\n const out: string[] = [];\n let i = 0;\n\n while (i < sql.length) {\n const char = sql[i]!;\n const next = sql[i + 1];\n\n if ((char === '-' && next === '-') || ((isMysql || rules.hashComments) && char === '#')) {\n const lineEnd = sql.indexOf('\\n', i);\n i = lineEnd === -1 ? sql.length : lineEnd;\n continue;\n }\n\n if (char === '/' && next === '*') {\n i = findBlockCommentEnd(sql, i, !!rules.nestedComments);\n continue;\n }\n\n // In a dollar-quoted body (`$$body$$`, `$tag$body$tag$`) nothing has syntax meaning. Read the\n // previous character from the query, not from `out`, where a dropped comment would leave `$$`\n // looking like part of an identifier. Of the `standard` engines only PostgreSQL has dollar\n // quoting. SQLite `$name` parameters do not match the tag pattern, apart from the rare `$a$b`.\n if (base === 'standard' && char === '$' && !isIdentifierChar(sql[i - 1])) {\n const tag = matchDollarQuoteTag(sql, i, rules.dollarQuote);\n if (tag) {\n const bodyEnd = sql.indexOf(tag, i + tag.length);\n i = bodyEnd === -1 ? sql.length : bodyEnd + tag.length;\n out.push('?');\n continue;\n }\n }\n\n const identifierCloser = getIdentifierCloser(char, base);\n if (identifierCloser) {\n const runEnd = findQuotedRunEnd(sql, i, identifierCloser, backslashEscapes);\n // A run that never closes is not an identifier, so it collapses instead of being copied out.\n // Copying would carry every literal in the rest of the statement through unlexed.\n out.push(runEnd === -1 ? '?' : sql.slice(i, runEnd));\n i = runEnd === -1 ? sql.length : runEnd;\n continue;\n }\n\n if (char === \"'\" || (char === '\"' && isMysql)) {\n // A prefix like `X'1A'`, `B'01'`, `N'…'` or PostgreSQL's `E'a\\nb'` is part of the literal, so it has\n // to collapse into the same `?` instead of being left behind as a bare identifier.\n const prefix = char === \"'\" ? getLiteralPrefix(out, base) : undefined;\n if (prefix) {\n out.pop();\n }\n const runEnd = findQuotedRunEnd(sql, i, char, isMysql || backslashEscapes || prefix === 'E');\n i = runEnd === -1 ? sql.length : runEnd;\n out.push('?');\n continue;\n }\n\n const literalLength = rules.matchLiteral?.(sql, i);\n if (literalLength) {\n out.push('?');\n i += literalLength;\n continue;\n }\n if (rules.isInlineData?.(sql, i, out)) {\n break;\n }\n out.push(char);\n i++;\n }\n\n return out.join('');\n}\n\n/**\n * Returns the character that closes an identifier opened by `char`, or undefined if `char` opens\n * none. SQL Server brackets close on `]`, and `]]` escapes a `]` inside the name, which is the same\n * doubling rule `findQuotedRunEnd` applies to quotes.\n */\nfunction getIdentifierCloser(char: string, dialect: SqlDialect): string | undefined {\n if (char === '`') {\n return '`';\n }\n if (char === '\"' && dialect !== 'mysql') {\n return '\"';\n }\n return char === '[' && dialect === 'mssql' ? ']' : undefined;\n}\n\n/** Whether `char` can appear inside an identifier. `undefined` (start of query) counts as a break. */\nexport function isIdentifierChar(char: string | undefined): boolean {\n return char !== undefined && /[\\w$]/.test(char);\n}\n\n/** Returns the opening dollar-quote tag at `start` (`$$` or `$tag$`), or undefined if there is none. */\nfunction matchDollarQuoteTag(sql: string, start: number, pattern = DOLLAR_QUOTE_RE): string | undefined {\n pattern.lastIndex = start;\n return pattern.exec(sql)?.[0];\n}\n\n/**\n * Returns the literal-prefix character immediately before a `'`, if there is one: `X`/`B` for\n * hex/binary literals, `N` for a national-character literal (SQL Server, MySQL), or `E` for a\n * PostgreSQL escape string (which honors backslash escapes).\n */\nfunction getLiteralPrefix(out: string[], dialect: SqlDialect): 'X' | 'B' | 'N' | 'E' | undefined {\n const last = out[out.length - 1];\n // A prefix only counts when it stands alone — the `X` in `MAX'...'` belongs to the identifier\n if (last?.length !== 1 || isIdentifierChar(out[out.length - 2]?.slice(-1))) {\n return undefined;\n }\n\n const prefix = last.toUpperCase();\n if (prefix === 'X' || prefix === 'B' || prefix === 'N') {\n return prefix;\n }\n return prefix === 'E' && dialect === 'standard' ? 'E' : undefined;\n}\n\n/**\n * Sanitize SQL query as per the OTEL semantic conventions\n * https://opentelemetry.io/docs/specs/semconv/database/database-spans/#sanitization-of-dbquerytext\n *\n * Parameter placeholders survive: PostgreSQL `$n`, SQLite `?n`, and named forms like `:name` and\n * `@name`. Per the OTEL spec they mark a parameterized query, so only values (strings, numbers,\n * booleans) are sanitized.\n *\n * Pass `dialect` when the statement comes from a driver whose literals are not standard-quoted;\n * see {@link SqlDialect} and {@link SqlLexerRules}.\n */\nexport function sanitizeSqlQuery(\n sqlQuery: string | undefined,\n dialect: SqlDialect | SqlLexerRules = 'standard',\n): string {\n if (!sqlQuery) {\n return 'Unknown SQL Query';\n }\n\n return (\n // Strip comments and string literals first: everything below is a regex that cannot tell\n // whether it is looking at SQL syntax or at a user-supplied value.\n stripLiteralsAndComments(sqlQuery, dialect)\n .replace(/;\\s*$/, '') // Remove trailing semicolons\n .replace(/^[\\s;]+/, '') // Remove leading semicolons (T-SQL's `;WITH`)\n // Collapse whitespace to a single space (after removing comments)\n .replace(/\\s+/g, ' ')\n .trim() // Remove extra spaces and trim\n // Sanitize hex numbers\n .replace(/\\b0x[0-9A-Fa-f]+/gi, '?')\n // Sanitize boolean literals\n .replace(/\\b(?:TRUE|FALSE)\\b/gi, '?')\n // Sanitize numeric literals (preserve $n placeholders via negative lookbehind)\n .replace(/-?\\b\\d+\\.?\\d*[eE][+-]?\\d+\\b/g, '?') // Scientific notation\n .replace(/-?\\b\\d+\\.\\d+\\b/g, '?') // Decimals\n .replace(/-?\\.\\d+\\b/g, '?') // Decimals starting with dot\n .replace(getIntegerLiteralRE(dialect), '?') // Integers (NOT parameter placeholders)\n // Collapse IN clauses for cardinality (both ? and $n variants)\n .replace(/\\bIN\\b\\s*\\(\\s*\\?(?:\\s*,\\s*\\?)*\\s*\\)/gi, 'IN (?)')\n .replace(/\\bIN\\b\\s*\\(\\s*\\$\\d+(?:\\s*,\\s*\\$\\d+)*\\s*\\)/gi, 'IN ($?)')\n );\n}\n\nexport interface SqlQueryAttributes {\n [DB_QUERY_TEXT]: string | undefined;\n [DB_QUERY_SUMMARY]: string | undefined;\n [DB_OPERATION_NAME]: string | undefined;\n}\n\n/**\n * Sanitizes a collected SQL statement into the query attributes the SQL integrations attach to\n * their spans: `db.query.text`, `db.query.summary` and `db.operation.name`. All are `undefined`\n * when there is no statement, so an empty query omits the attributes instead of reporting the\n * sanitizer's fallback text.\n */\nexport function getSqlQueryAttributes(\n sqlQuery: string | undefined,\n dialect?: SqlDialect | SqlLexerRules,\n): SqlQueryAttributes {\n const queryText = (sqlQuery && sanitizeSqlQuery(sqlQuery, dialect)) || undefined;\n return {\n [DB_QUERY_TEXT]: queryText,\n [DB_QUERY_SUMMARY]: getSqlQuerySummary(queryText),\n [DB_OPERATION_NAME]: getSqlOperationName(queryText),\n };\n}\n\n/**\n * Names a SQL span with a low-cardinality name: `db.query.summary`, falling back to `db.namespace`\n * and then `db.system.name`. `fallback` is the integration's name for a span with none of those.\n *\n * New SQL integrations should name their spans with this regardless of span streaming.\n */\nexport function getLowCardinalitySqlSpanName(attributes: SpanAttributes, fallback: string): string {\n return toSpanName(attributes[DB_QUERY_SUMMARY] || attributes[DB_NAMESPACE] || attributes[DB_SYSTEM_NAME], fallback);\n}\n\n/**\n * Names a SQL span from its attributes. Streamed span names have to be low cardinality (see\n * {@link getLowCardinalitySqlSpanName}); otherwise the sanitized `db.query.text` is used, which\n * existing integrations keep for spans that aren't streamed.\n */\nexport function getSqlSpanName(attributes: SpanAttributes, fallback: string): string {\n const client = getClient();\n if (client && hasSpanStreamingEnabled(client)) {\n return getLowCardinalitySqlSpanName(attributes, fallback);\n }\n return toSpanName(attributes[DB_QUERY_TEXT], fallback);\n}\n\nfunction toSpanName(value: unknown, fallback: string): string {\n return typeof value === 'string' && value ? value : fallback;\n}\n"],"mappings":";;;AAWA,MAAM,qBAAqB;AAI3B,MAAM,aAAa;AAKnB,MAAM,aAAa,GAAG,WAAW,QAAQ,WAAW;AAEpD,MAAM,SAAS,IAAI,OACjB,qHAAqH,WAAW,IAChI,GACF;AAMA,MAAM,YAAY,IAAI,OACpB,4HAA4H,WAAW,IACvI,GACF;AACA,MAAM,YAAY,IAAI,OACpB,8FAA8F,WAAW,IACzG,GACF;AACA,MAAM,YAAY,IAAI,OAAO,iDAAiD,WAAW,IAAI,GAAG;AAEhG,MAAM,YAAY;AAElB,MAAM,YAAY;AAElB,MAAM,WAAW;AACjB,MAAM,eAAe,IAAI,OAAO,IAAI,YAAY;AAChD,MAAM,iBAAiB,IAAI,OAAO,cAAc,WAAW,EAAE;AAC7D,MAAM,qBAAqB;;;;;;;;;;;;;;AAe3B,SAAgB,mBAAmB,OAA+C;CAChF,IAAI,CAAC,OACH;CAGF,MAAM,cAAc,UAAU,KAAK,KAAK;CACxC,IAAI,aAAa,SAAS,gBAAgB,YAAY,OAAO,YAAY;EACvE,MAAM,YAAY,YAAY,OAAO;EACrC,MAAM,UAAU,YAAY,OAAO;EACnC,MAAM,WAAW,QAAQ,QAAQ,GAAG;EACpC,OAAO,SAAS,GAAG,UAAU,GAAG,YAAY,IAAI,QAAQ,UAAU,GAAG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entry/conventions/attributes';\nimport type { SpanAttributes } from '@sentry/core';\nimport { getClient, hasSpanStreamingEnabled } from '@sentry/core';\n\nconst MAX_SUMMARY_LENGTH = 255;\n\n// A single identifier: quoted (`\"...\"`, `'...'`, or MySQL backticks) or bare. The quoted forms have\n// to be matched as a unit, otherwise an identifier containing a space or a dot is cut in half.\nconst IDENTIFIER = '(?:\"[^\"]*\"|\\'[^\\']*\\'|`[^`]*`|[^\\\\s(,;).\\'\"`]+)';\n\n// A table reference can be schema-qualified (`\"public\".\"User\"`, `db.schema.table`), with each part\n// quoted independently. The whole qualified name is the summary target, since the schema is what\n// distinguishes two same-named tables.\nconst TABLE_NAME = `${IDENTIFIER}(?:\\\\.${IDENTIFIER})*`;\n\nconst DDL_RE = new RegExp(\n `^\\\\s*(?<operation>(?:CREATE|DROP)\\\\s+(?:TABLE|INDEX)|ALTER\\\\s+TABLE)(?:\\\\s+IF\\\\s+(?:NOT\\\\s+)?EXISTS)?\\\\s+(?<table>${TABLE_NAME})`,\n 'i',\n);\n\n// SQLite upserts insert an optional conflict clause between operation and INTO\n// (`INSERT OR REPLACE INTO`, https://sqlite.org/lang_insert.html), with `REPLACE INTO` as the\n// standalone shorthand. The clause is filler like INTO — stripping it keeps upserts on the same\n// low-cardinality summary as plain inserts.\nconst INSERT_RE = new RegExp(\n `^\\\\s*(?<operation>INSERT|REPLACE)(?:\\\\s+OR\\\\s+(?:ROLLBACK|ABORT|FAIL|IGNORE|REPLACE))?\\\\s+INTO(?:\\\\s+TABLE)?\\\\s+(?<table>${TABLE_NAME})`,\n 'i',\n);\nconst UPDATE_RE = new RegExp(\n `^\\\\s*(?<operation>UPDATE)(?:\\\\s+OR\\\\s+(?:ROLLBACK|ABORT|FAIL|IGNORE|REPLACE))?\\\\s+(?<table>${TABLE_NAME})`,\n 'i',\n);\nconst DELETE_RE = new RegExp(`^\\\\s*(?<operation>DELETE)\\\\s+FROM\\\\s+(?<table>${TABLE_NAME})`, 'i');\n\nconst SELECT_RE = /^\\s*(?:\\(\\s*)?(?<operation>SELECT)\\b/i;\n\nconst PRAGMA_RE = /^\\s*(?<operation>PRAGMA)\\s+(?<command>\\S+)/i;\n\nconst TOKEN_RE = /\\b(?:FROM|JOIN)\\s+|\\(\\s*(SELECT)\\b|\\b(?:UNION|INTERSECT|EXCEPT|MINUS)\\s+(?:ALL\\s+)?(SELECT)\\b/gi;\nconst TABLE_REF_RE = new RegExp(`^${TABLE_NAME}`);\nconst COMMA_TABLE_RE = new RegExp(`^\\\\s*,\\\\s*(${TABLE_NAME})`);\nconst SUBQUERY_SELECT_RE = /^\\(\\s*(SELECT)\\b/i;\n\n/**\n * Derives a low-cardinality summary from a SQL query for use as `db.query.summary`.\n *\n * Conforms to the OTEL semantic convention for generating query summaries:\n * - Preserves original case of operations and identifiers (no normalization)\n * - Uses format: `{operation} {target1} {target2} ...`\n * - Strips filler words (INTO, FROM) from the operation\n * - Captures multiple table targets (JOINs)\n * - Handles INSERT...SELECT with both targets\n * - Truncates to 255 characters without splitting mid-value\n *\n * @see https://opentelemetry.io/docs/specs/semconv/database/database-spans/#generating-a-summary-of-the-query\n */\nexport function getSqlQuerySummary(query: string | undefined): string | undefined {\n if (!query) {\n return undefined;\n }\n\n const pragmaMatch = PRAGMA_RE.exec(query);\n if (pragmaMatch?.groups?.['operation'] && pragmaMatch.groups['command']) {\n const operation = pragmaMatch.groups['operation'];\n const command = pragmaMatch.groups['command'];\n const parenIdx = command.indexOf('(');\n return truncate(`${operation} ${parenIdx >= 0 ? command.substring(0, parenIdx) : command}`);\n }\n\n const ddlMatch = DDL_RE.exec(query);\n if (ddlMatch?.groups?.['operation'] && ddlMatch.groups['table']) {\n return truncate(`${ddlMatch.groups['operation']} ${ddlMatch.groups['table']}`);\n }\n\n const insertMatch = INSERT_RE.exec(query);\n if (insertMatch?.groups?.['operation'] && insertMatch.groups['table']) {\n const parts = [insertMatch.groups['operation'], insertMatch.groups['table']];\n const rest = query.slice(insertMatch[0].length);\n const subSelect = /\\b(SELECT)\\b/i.exec(rest);\n if (subSelect?.[1]) {\n parts.push(subSelect[1]);\n const selectTables = extractTableNames(rest.slice(subSelect.index));\n parts.push(...selectTables);\n }\n return truncate(parts.join(' '));\n }\n\n const updateMatch = UPDATE_RE.exec(query);\n if (updateMatch?.groups?.['operation'] && updateMatch.groups['table']) {\n return truncate(`${updateMatch.groups['operation']} ${updateMatch.groups['table']}`);\n }\n\n const deleteMatch = DELETE_RE.exec(query);\n if (deleteMatch?.groups?.['operation'] && deleteMatch.groups['table']) {\n return truncate(`${deleteMatch.groups['operation']} ${deleteMatch.groups['table']}`);\n }\n\n const selectMatch = SELECT_RE.exec(query);\n if (selectMatch?.groups?.['operation']) {\n const tables = extractTableNames(query.slice(selectMatch[0].length));\n if (tables.length > 0) {\n return truncate(`${selectMatch.groups['operation']} ${tables.join(' ')}`);\n }\n return selectMatch.groups['operation'];\n }\n\n return truncate(query.trim().split(/\\s+/)[0] ?? query);\n}\n\nconst LEADING_KEYWORD_RE = /^\\s*(?:\\(\\s*)*([A-Za-z]+)\\b/;\nconst CTE_MAIN_STATEMENT_RE = /\\(|\\)|\\b(SELECT|INSERT|UPDATE|DELETE|MERGE|VALUES|TABLE)\\b/gi;\n\n/**\n * Derives `db.operation.name` from a SQL query: the first operation keyword, in its original case.\n *\n * @see https://opentelemetry.io/docs/specs/semconv/registry/attributes/db/#db-operation-name\n */\nexport function getSqlOperationName(query: string | undefined): string | undefined {\n const match = query ? LEADING_KEYWORD_RE.exec(query) : null;\n const keyword = match?.[1];\n if (!query || !match || !keyword) {\n return undefined;\n }\n // Scanned from after `WITH`, so parentheses wrapping the whole query don't shift the depth.\n return keyword.toUpperCase() === 'WITH' ? getCteMainOperationName(query.slice(match[0].length)) : keyword;\n}\n\n/**\n * The operation of a `WITH` query is its main statement: the first operation keyword outside the\n * CTE bodies, which are all parenthesized. Counting parentheses is safe on a sanitized query, which\n * has no literals or comments left.\n */\nfunction getCteMainOperationName(query: string): string | undefined {\n let depth = 0;\n for (const match of query.matchAll(CTE_MAIN_STATEMENT_RE)) {\n if (match[0] === '(') {\n depth++;\n } else if (match[0] === ')') {\n depth--;\n } else if (depth === 0) {\n return match[1];\n }\n }\n return undefined;\n}\n\nfunction extractTableNames(sql: string): string[] {\n const tables: string[] = [];\n TOKEN_RE.lastIndex = 0;\n let match: RegExpExecArray | null;\n\n while ((match = TOKEN_RE.exec(sql)) !== null) {\n const table = match[1] || match[2];\n if (table) {\n tables.push(table);\n continue;\n }\n\n const rest = sql.slice(match.index + match[0].length);\n\n const subqueryMatch = SUBQUERY_SELECT_RE.exec(rest);\n if (subqueryMatch?.[1]) {\n tables.push(subqueryMatch[1]);\n TOKEN_RE.lastIndex = match.index + match[0].length + subqueryMatch[0].length;\n continue;\n }\n\n const tableMatch = TABLE_REF_RE.exec(rest);\n if (!tableMatch) continue;\n tables.push(tableMatch[0]);\n\n let afterTable = rest.slice(tableMatch[0].length);\n let commaMatch: RegExpExecArray | null;\n while ((commaMatch = COMMA_TABLE_RE.exec(afterTable)) !== null) {\n if (!commaMatch[1]) break;\n tables.push(commaMatch[1]);\n afterTable = afterTable.slice(commaMatch[0].length);\n }\n }\n\n return tables;\n}\n\nfunction truncate(summary: string): string {\n if (summary.length <= MAX_SUMMARY_LENGTH) {\n return summary;\n }\n const truncated = summary.substring(0, MAX_SUMMARY_LENGTH);\n const lastSpace = truncated.lastIndexOf(' ');\n return lastSpace > 0 ? truncated.substring(0, lastSpace) : truncated;\n}\n\nlet integerLiteralRE: RegExp | undefined;\nlet mssqlIntegerLiteralRE: RegExp | undefined;\n\n/**\n * The lookbehind keeps `$n` and `?n` parameter placeholders out of the match. T-SQL has neither,\n * and `$1000` there is a money literal, so `$` only guards a placeholder outside `mssql`.\n *\n * Lazy init: constructing a lookbehind at module scope evaluates it on import and crashes\n * Safari <16.4 browser bundles that reach this file via the core barrel.\n */\nfunction getIntegerLiteralRE(dialect: SqlDialect | SqlLexerRules): RegExp {\n if (dialect === 'mssql') {\n if (!mssqlIntegerLiteralRE) {\n mssqlIntegerLiteralRE = new RegExp('(?<!\\\\?)-?\\\\b\\\\d+\\\\b', 'g');\n }\n return mssqlIntegerLiteralRE;\n }\n if (!integerLiteralRE) {\n integerLiteralRE = new RegExp('(?<![$?])-?\\\\b\\\\d+\\\\b', 'g');\n }\n return integerLiteralRE;\n}\n\n/**\n * SQL dialect variants that matter for finding the end of a string literal:\n * - `standard` (PostgreSQL, SQLite): `\"` quotes identifiers, `''` is the only in-string escape,\n * and PostgreSQL's `$$…$$` dollar quoting opens a literal.\n * - `mysql`: `\"` quotes a string literal unless `ANSI_QUOTES` is set, and `\\` escapes the next\n * character unless `NO_BACKSLASH_ESCAPES` is set. Both default to off, and mysql/mysql2 escape\n * inlined values with backslashes, so this is the mode their statements arrive in.\n * - `mssql`: `[...]` quotes an identifier, so a `'` inside one is part of the name. `\"` quotes\n * one too, unless the connection sets `QUOTED_IDENTIFIER OFF`, which tedious leaves on.\n *\n * An engine with other rules passes {@link SqlLexerRules} instead.\n */\nexport type SqlDialect = 'standard' | 'mysql' | 'mssql';\n\n/**\n * Lexer rules for an engine that no {@link SqlDialect} covers. They apply on top of `standard`. The\n * integration of that engine defines them, so a bundle without that integration does not contain them.\n */\nexport interface SqlLexerRules {\n /** Whether `#` starts a line comment. */\n hashComments?: boolean;\n /** Whether a block comment can contain other block comments. */\n nestedComments?: boolean;\n /** Whether `\\` escapes the next character in a string literal or a quoted identifier. */\n backslashEscapes?: boolean;\n /** Sticky pattern for the opening tag of a dollar-quoted literal. Defaults to the PostgreSQL tag. */\n dollarQuote?: RegExp;\n /** Returns the length of the engine-specific literal at `start`, which the lexer replaces with `?`. */\n matchLiteral?: (sql: string, start: number) => number;\n /**\n * Returns true when inline data starts at `start`. The lexer drops the query text from `start` to the\n * end, because data cannot be sanitized as SQL. `out` holds the sanitized text before `start`.\n */\n isInlineData?: (sql: string, start: number, out: string[]) => boolean;\n}\n\n/**\n * Maps a driver or `db.system.name` value to the dialect its statements are written in. Callers\n * report different spellings for one engine: knex uses the driver name, Prisma the provider name,\n * and OTel the semantic-convention name. An engine we do not know about is lexed as `standard`.\n */\nexport function toSqlDialect(system: unknown): SqlDialect {\n if (system === 'mysql' || system === 'mysql2' || system === 'mariadb') {\n return 'mysql';\n }\n if (system === 'mssql' || system === 'sqlserver' || system === 'microsoft.sql_server') {\n return 'mssql';\n }\n return 'standard';\n}\n\nconst NO_RULES: SqlLexerRules = {};\n\n// Sticky, so the scanner can test one position without slicing the query on every `$`.\nconst DOLLAR_QUOTE_RE = /\\$(?:[A-Za-z_]\\w*)?\\$/y;\n\n/**\n * Returns the index just past the run's closing `delimiter`, or -1 if the run never closes. The\n * caller cannot derive that from the index alone: a query ending in `[a]]` consumed a doubled\n * delimiter, not a closing one.\n *\n * A doubled delimiter (`''`) escapes itself in every dialect; backslash escapes are dialect- and\n * context-dependent, so the caller decides.\n */\nfunction findQuotedRunEnd(sql: string, start: number, delimiter: string, backslashEscapes: boolean): number {\n for (let i = start + 1; i < sql.length; i++) {\n const char = sql[i];\n if (backslashEscapes && char === '\\\\') {\n i++;\n } else if (char === delimiter) {\n if (sql[i + 1] !== delimiter) {\n return i + 1;\n }\n i++;\n }\n }\n return -1;\n}\n\n// An unterminated comment consumes the rest of the query.\nfunction findBlockCommentEnd(sql: string, start: number, nested: boolean): number {\n let depth = 1;\n let i = start + 2;\n while (i < sql.length && depth > 0) {\n if (sql[i] === '*' && sql[i + 1] === '/') {\n depth--;\n i += 2;\n } else if (nested && sql[i] === '/' && sql[i + 1] === '*') {\n depth++;\n i += 2;\n } else {\n i++;\n }\n }\n return i;\n}\n\n/**\n * Replaces every string literal with `?` and drops every comment, in one pass.\n *\n * Doing this by scanning rather than by regex is what keeps quote state and comment state from\n * being decided independently: a regex for `'...'` cannot see that the quote it stopped at was\n * backslash-escaped, and a regex for `--...` cannot see that the `--` sits inside a literal. Both\n * mistakes end with user data surviving into `db.query.text` and `db.query.summary`.\n *\n * Quoted identifiers are preserved — they are the table and column names the query summary is\n * built from.\n */\nfunction stripLiteralsAndComments(sql: string, dialect: SqlDialect | SqlLexerRules): string {\n const [base, rules]: [SqlDialect, SqlLexerRules] =\n typeof dialect === 'string' ? [dialect, NO_RULES] : ['standard', dialect];\n const isMysql = base === 'mysql';\n const backslashEscapes = !!rules.backslashEscapes;\n const out: string[] = [];\n let i = 0;\n\n while (i < sql.length) {\n const char = sql.charAt(i);\n const next = sql[i + 1];\n\n if ((char === '-' && next === '-') || ((isMysql || rules.hashComments) && char === '#')) {\n const lineEnd = sql.indexOf('\\n', i);\n i = lineEnd === -1 ? sql.length : lineEnd;\n continue;\n }\n\n if (char === '/' && next === '*') {\n i = findBlockCommentEnd(sql, i, !!rules.nestedComments);\n continue;\n }\n\n // In a dollar-quoted body (`$$body$$`, `$tag$body$tag$`) nothing has syntax meaning. Read the\n // previous character from the query, not from `out`, where a dropped comment would leave `$$`\n // looking like part of an identifier. Of the `standard` engines only PostgreSQL has dollar\n // quoting. SQLite `$name` parameters do not match the tag pattern, apart from the rare `$a$b`.\n if (base === 'standard' && char === '$' && !isIdentifierChar(sql[i - 1])) {\n const tag = matchDollarQuoteTag(sql, i, rules.dollarQuote);\n if (tag) {\n const bodyEnd = sql.indexOf(tag, i + tag.length);\n i = bodyEnd === -1 ? sql.length : bodyEnd + tag.length;\n out.push('?');\n continue;\n }\n }\n\n const identifierCloser = getIdentifierCloser(char, base);\n if (identifierCloser) {\n const runEnd = findQuotedRunEnd(sql, i, identifierCloser, backslashEscapes);\n // A run that never closes is not an identifier, so it collapses instead of being copied out.\n // Copying would carry every literal in the rest of the statement through unlexed.\n out.push(runEnd === -1 ? '?' : sql.slice(i, runEnd));\n i = runEnd === -1 ? sql.length : runEnd;\n continue;\n }\n\n if (char === \"'\" || (char === '\"' && isMysql)) {\n // A prefix like `X'1A'`, `B'01'`, `N'…'` or PostgreSQL's `E'a\\nb'` is part of the literal, so it has\n // to collapse into the same `?` instead of being left behind as a bare identifier.\n const prefix = char === \"'\" ? getLiteralPrefix(out, base) : undefined;\n if (prefix) {\n out.pop();\n }\n const runEnd = findQuotedRunEnd(sql, i, char, isMysql || backslashEscapes || prefix === 'E');\n i = runEnd === -1 ? sql.length : runEnd;\n out.push('?');\n continue;\n }\n\n const literalLength = rules.matchLiteral?.(sql, i);\n if (literalLength) {\n out.push('?');\n i += literalLength;\n continue;\n }\n if (rules.isInlineData?.(sql, i, out)) {\n break;\n }\n out.push(char);\n i++;\n }\n\n return out.join('');\n}\n\n/**\n * Returns the character that closes an identifier opened by `char`, or undefined if `char` opens\n * none. SQL Server brackets close on `]`, and `]]` escapes a `]` inside the name, which is the same\n * doubling rule `findQuotedRunEnd` applies to quotes.\n */\nfunction getIdentifierCloser(char: string, dialect: SqlDialect): string | undefined {\n if (char === '`') {\n return '`';\n }\n if (char === '\"' && dialect !== 'mysql') {\n return '\"';\n }\n return char === '[' && dialect === 'mssql' ? ']' : undefined;\n}\n\n/** Whether `char` can appear inside an identifier. `undefined` (start of query) counts as a break. */\nexport function isIdentifierChar(char: string | undefined): boolean {\n return char !== undefined && /[\\w$]/.test(char);\n}\n\n/** Returns the opening dollar-quote tag at `start` (`$$` or `$tag$`), or undefined if there is none. */\nfunction matchDollarQuoteTag(sql: string, start: number, pattern = DOLLAR_QUOTE_RE): string | undefined {\n pattern.lastIndex = start;\n return pattern.exec(sql)?.[0];\n}\n\n/**\n * Returns the literal-prefix character immediately before a `'`, if there is one: `X`/`B` for\n * hex/binary literals, `N` for a national-character literal (SQL Server, MySQL), or `E` for a\n * PostgreSQL escape string (which honors backslash escapes).\n */\nfunction getLiteralPrefix(out: string[], dialect: SqlDialect): 'X' | 'B' | 'N' | 'E' | undefined {\n const last = out[out.length - 1];\n // A prefix only counts when it stands alone — the `X` in `MAX'...'` belongs to the identifier\n if (last?.length !== 1 || isIdentifierChar(out[out.length - 2]?.slice(-1))) {\n return undefined;\n }\n\n const prefix = last.toUpperCase();\n if (prefix === 'X' || prefix === 'B' || prefix === 'N') {\n return prefix;\n }\n return prefix === 'E' && dialect === 'standard' ? 'E' : undefined;\n}\n\n/**\n * Sanitize SQL query as per the OTEL semantic conventions\n * https://opentelemetry.io/docs/specs/semconv/database/database-spans/#sanitization-of-dbquerytext\n *\n * Parameter placeholders survive: PostgreSQL `$n`, SQLite `?n`, and named forms like `:name` and\n * `@name`. Per the OTEL spec they mark a parameterized query, so only values (strings, numbers,\n * booleans) are sanitized.\n *\n * Pass `dialect` when the statement comes from a driver whose literals are not standard-quoted;\n * see {@link SqlDialect} and {@link SqlLexerRules}.\n */\nexport function sanitizeSqlQuery(\n sqlQuery: string | undefined,\n dialect: SqlDialect | SqlLexerRules = 'standard',\n): string {\n if (!sqlQuery) {\n return 'Unknown SQL Query';\n }\n\n return (\n // Strip comments and string literals first: everything below is a regex that cannot tell\n // whether it is looking at SQL syntax or at a user-supplied value.\n stripLiteralsAndComments(sqlQuery, dialect)\n .replace(/;\\s*$/, '') // Remove trailing semicolons\n .replace(/^[\\s;]+/, '') // Remove leading semicolons (T-SQL's `;WITH`)\n // Collapse whitespace to a single space (after removing comments)\n .replace(/\\s+/g, ' ')\n .trim() // Remove extra spaces and trim\n // Sanitize hex numbers\n .replace(/\\b0x[0-9A-Fa-f]+/gi, '?')\n // Sanitize boolean literals\n .replace(/\\b(?:TRUE|FALSE)\\b/gi, '?')\n // Sanitize numeric literals (preserve $n placeholders via negative lookbehind)\n .replace(/-?\\b\\d+\\.?\\d*[eE][+-]?\\d+\\b/g, '?') // Scientific notation\n .replace(/-?\\b\\d+\\.\\d+\\b/g, '?') // Decimals\n .replace(/-?\\.\\d+\\b/g, '?') // Decimals starting with dot\n .replace(getIntegerLiteralRE(dialect), '?') // Integers (NOT parameter placeholders)\n // Collapse IN clauses for cardinality (both ? and $n variants)\n .replace(/\\bIN\\b\\s*\\(\\s*\\?(?:\\s*,\\s*\\?)*\\s*\\)/gi, 'IN (?)')\n .replace(/\\bIN\\b\\s*\\(\\s*\\$\\d+(?:\\s*,\\s*\\$\\d+)*\\s*\\)/gi, 'IN ($?)')\n );\n}\n\nexport interface SqlQueryAttributes {\n [DB_QUERY_TEXT]: string | undefined;\n [DB_QUERY_SUMMARY]: string | undefined;\n [DB_OPERATION_NAME]: string | undefined;\n}\n\n/**\n * Sanitizes a collected SQL statement into the query attributes the SQL integrations attach to\n * their spans: `db.query.text`, `db.query.summary` and `db.operation.name`. All are `undefined`\n * when there is no statement, so an empty query omits the attributes instead of reporting the\n * sanitizer's fallback text.\n */\nexport function getSqlQueryAttributes(\n sqlQuery: string | undefined,\n dialect?: SqlDialect | SqlLexerRules,\n): SqlQueryAttributes {\n const queryText = (sqlQuery && sanitizeSqlQuery(sqlQuery, dialect)) || undefined;\n return {\n [DB_QUERY_TEXT]: queryText,\n [DB_QUERY_SUMMARY]: getSqlQuerySummary(queryText),\n [DB_OPERATION_NAME]: getSqlOperationName(queryText),\n };\n}\n\n/**\n * Names a SQL span with a low-cardinality name: `db.query.summary`, falling back to `db.namespace`\n * and then `db.system.name`. `fallback` is the integration's name for a span with none of those.\n *\n * New SQL integrations should name their spans with this regardless of span streaming.\n */\nexport function getLowCardinalitySqlSpanName(attributes: SpanAttributes, fallback: string): string {\n return toSpanName(attributes[DB_QUERY_SUMMARY] || attributes[DB_NAMESPACE] || attributes[DB_SYSTEM_NAME], fallback);\n}\n\n/**\n * Names a SQL span from its attributes. Streamed span names have to be low cardinality (see\n * {@link getLowCardinalitySqlSpanName}); otherwise the sanitized `db.query.text` is used, which\n * existing integrations keep for spans that aren't streamed.\n */\nexport function getSqlSpanName(attributes: SpanAttributes, fallback: string): string {\n const client = getClient();\n if (client && hasSpanStreamingEnabled(client)) {\n return getLowCardinalitySqlSpanName(attributes, fallback);\n }\n return toSpanName(attributes[DB_QUERY_TEXT], fallback);\n}\n\nfunction toSpanName(value: unknown, fallback: string): string {\n return typeof value === 'string' && value ? value : fallback;\n}\n"],"mappings":";;;AAWA,MAAM,qBAAqB;AAI3B,MAAM,aAAa;AAKnB,MAAM,aAAa,GAAG,WAAW,QAAQ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UACA,SACoB;CACpB,MAAM,YAAa,YAAY,iBAAiB,UAAU,OAAO,KAAM,KAAA;CACvE,OAAO;GACJ,gBAAgB;GAChB,mBAAmB,mBAAmB,SAAS;GAC/C,oBAAoB,oBAAoB,SAAS;CACpD;AACF;;;;;;;AAQA,SAAgB,6BAA6B,YAA4B,UAA0B;CACjG,OAAO,WAAW,WAAW,qBAAqB,WAAW,iBAAiB,WAAW,iBAAiB,QAAQ;AACpH;;;;;;AAOA,SAAgB,eAAe,YAA4B,UAA0B;CACnF,MAAM,SAAS,UAAU;CACzB,IAAI,UAAU,wBAAwB,MAAM,GAC1C,OAAO,6BAA6B,YAAY,QAAQ;CAE1D,OAAO,WAAW,WAAW,gBAAgB,QAAQ;AACvD;AAEA,SAAS,WAAW,OAAgB,UAA0B;CAC5D,OAAO,OAAO,UAAU,YAAY,QAAQ,QAAQ;AACtD"}
@@ -1,6 +1,6 @@
1
1
  import { DEBUG_BUILD } from "../debug-build.js";
2
2
  import { debug } from "@sentry/core";
3
- import { _INTERNAL_handleServedNodeTunnelRequest, _INTERNAL_httpServerHandlesTunnel } from "@sentry/core/server";
3
+ import { handleServedNodeTunnelRequest, httpServerHandlesTunnel } from "@sentry/core/server";
4
4
  // src/utils/tunnelServer.ts
5
5
  const tunnelServers = /* @__PURE__ */ new WeakSet();
6
6
  /**
@@ -14,12 +14,12 @@ const tunnelServers = /* @__PURE__ */ new WeakSet();
14
14
  function instrumentTunnelServer(message) {
15
15
  try {
16
16
  const server = message?.server;
17
- if (!server || tunnelServers.has(server) || _INTERNAL_httpServerHandlesTunnel()) return;
17
+ if (!server || tunnelServers.has(server) || httpServerHandlesTunnel()) return;
18
18
  tunnelServers.add(server);
19
19
  const originalEmit = server.emit;
20
20
  server.emit = function(event, ...data) {
21
21
  const [request, response] = data;
22
- if (event === "request" && _INTERNAL_handleServedNodeTunnelRequest(request, response)) return true;
22
+ if (event === "request" && handleServedNodeTunnelRequest(request, response)) return true;
23
23
  return originalEmit.call(this, event, ...data);
24
24
  };
25
25
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"tunnelServer.js","names":["httpServerHandlesTunnel","handleServedNodeTunnelRequest"],"sources":["../../../src/utils/tunnelServer.ts"],"sourcesContent":["import { debug } from '@sentry/core';\nimport {\n _INTERNAL_handleServedNodeTunnelRequest as handleServedNodeTunnelRequest,\n _INTERNAL_httpServerHandlesTunnel as httpServerHandlesTunnel,\n} from '@sentry/core/server';\nimport { DEBUG_BUILD } from '../debug-build';\n\ntype TunnelServer = { emit(event: string, ...data: unknown[]): boolean };\n\nconst tunnelServers = new WeakSet<TunnelServer>();\n\n/**\n * Wraps a Node server's `emit` once, so requests to the tunnel `serveTunnelIntegration` serves are answered before\n * any of the app's `request` listeners run. A listener for the `http.server.request.start` diagnostics channel, which\n * Node publishes right before it emits each request, so even the first request is answered. Only without core's HTTP\n * server instrumentation, whose own `emit` wrapper answers them otherwise.\n *\n * It never throws, since Node rethrows a channel listener's error as an uncaught exception.\n */\nexport function instrumentTunnelServer(message: unknown): void {\n try {\n const server = (message as { server?: TunnelServer } | undefined)?.server;\n if (!server || tunnelServers.has(server) || httpServerHandlesTunnel()) {\n return;\n }\n\n tunnelServers.add(server);\n // oxlint-disable-next-line typescript/unbound-method -- called with the server as `this` below\n const originalEmit = server.emit;\n server.emit = function (this: TunnelServer, event: string, ...data: unknown[]) {\n const [request, response] = data as Parameters<typeof handleServedNodeTunnelRequest>;\n if (event === 'request' && handleServedNodeTunnelRequest(request, response)) {\n return true;\n }\n\n return originalEmit.call(this, event, ...data);\n };\n } catch (error) {\n DEBUG_BUILD && debug.error('Sentry tunnel: failed to instrument a server', error);\n }\n}\n"],"mappings":";;;;AASA,MAAM,gCAAgB,IAAI,QAAsB;;;;;;;;;AAUhD,SAAgB,uBAAuB,SAAwB;CAC7D,IAAI;EACF,MAAM,SAAU,SAAmD;EACnE,IAAI,CAAC,UAAU,cAAc,IAAI,MAAM,KAAKA,kCAAwB,GAClE;EAGF,cAAc,IAAI,MAAM;EAExB,MAAM,eAAe,OAAO;EAC5B,OAAO,OAAO,SAA8B,OAAe,GAAG,MAAiB;GAC7E,MAAM,CAAC,SAAS,YAAY;GAC5B,IAAI,UAAU,aAAaC,wCAA8B,SAAS,QAAQ,GACxE,OAAO;GAGT,OAAO,aAAa,KAAK,MAAM,OAAO,GAAG,IAAI;EAC/C;CACF,SAAS,OAAO;EACd,eAAe,MAAM,MAAM,gDAAgD,KAAK;CAClF;AACF"}
1
+ {"version":3,"file":"tunnelServer.js","names":[],"sources":["../../../src/utils/tunnelServer.ts"],"sourcesContent":["import { debug } from '@sentry/core';\nimport { handleServedNodeTunnelRequest, httpServerHandlesTunnel } from '@sentry/core/server';\nimport { DEBUG_BUILD } from '../debug-build';\n\ntype TunnelServer = { emit(event: string, ...data: unknown[]): boolean };\n\nconst tunnelServers = new WeakSet<TunnelServer>();\n\n/**\n * Wraps a Node server's `emit` once, so requests to the tunnel `serveTunnelIntegration` serves are answered before\n * any of the app's `request` listeners run. A listener for the `http.server.request.start` diagnostics channel, which\n * Node publishes right before it emits each request, so even the first request is answered. Only without core's HTTP\n * server instrumentation, whose own `emit` wrapper answers them otherwise.\n *\n * It never throws, since Node rethrows a channel listener's error as an uncaught exception.\n */\nexport function instrumentTunnelServer(message: unknown): void {\n try {\n const server = (message as { server?: TunnelServer } | undefined)?.server;\n if (!server || tunnelServers.has(server) || httpServerHandlesTunnel()) {\n return;\n }\n\n tunnelServers.add(server);\n // oxlint-disable-next-line typescript/unbound-method -- called with the server as `this` below\n const originalEmit = server.emit;\n server.emit = function (this: TunnelServer, event: string, ...data: unknown[]) {\n const [request, response] = data as Parameters<typeof handleServedNodeTunnelRequest>;\n if (event === 'request' && handleServedNodeTunnelRequest(request, response)) {\n return true;\n }\n\n return originalEmit.call(this, event, ...data);\n };\n } catch (error) {\n DEBUG_BUILD && debug.error('Sentry tunnel: failed to instrument a server', error);\n }\n}\n"],"mappings":";;;;AAMA,MAAM,gCAAgB,IAAI,QAAsB;;;;;;;;;AAUhD,SAAgB,uBAAuB,SAAwB;CAC7D,IAAI;EACF,MAAM,SAAU,SAAmD;EACnE,IAAI,CAAC,UAAU,cAAc,IAAI,MAAM,KAAK,wBAAwB,GAClE;EAGF,cAAc,IAAI,MAAM;EAExB,MAAM,eAAe,OAAO;EAC5B,OAAO,OAAO,SAA8B,OAAe,GAAG,MAAiB;GAC7E,MAAM,CAAC,SAAS,YAAY;GAC5B,IAAI,UAAU,aAAa,8BAA8B,SAAS,QAAQ,GACxE,OAAO;GAGT,OAAO,aAAa,KAAK,MAAM,OAAO,GAAG,IAAI;EAC/C;CACF,SAAS,OAAO;EACd,eAAe,MAAM,MAAM,gDAAgD,KAAK;CAClF;AACF"}
@@ -1,9 +1,10 @@
1
1
  import { DEBUG_BUILD } from "../debug-build.js";
2
2
  import { monitorStream } from "./monitorStream.js";
3
+ import { withServerTimingTraceHeader } from "./serverTimingTraceHeader.js";
3
4
  import { CLIENT_ADDRESS, CLIENT_PORT, HTTP_REQUEST_BODY_SIZE, NETWORK_PROTOCOL_NAME, SENTRY_KIND, SENTRY_OP, SENTRY_SEGMENT_NAME_SOURCE, USER_AGENT_ORIGINAL } from "@sentry/conventions/attributes";
4
5
  import { HTTP_SPAN_NAME_FALLBACK, SPAN_STATUS_ERROR, captureBodyFromWinterCGRequest, captureException, continueTrace, getCurrentScope, getHttpSpanDetailsFromUrlObject, hasSpanStreamingEnabled, hasSpansEnabled, httpHeadersToSpanAttributes, parseStringToURLObject, safeCallback, setHttpStatus, startSpanManual, winterCGHeadersToDict, winterCGRequestToRequestData, withIsolationScope, withScope } from "@sentry/core";
5
6
  import { HTTP_SERVER } from "@sentry/conventions/op";
6
- import { _INTERNAL_isServedTunnelRequest, classifyResponseStreaming, getClientIPAddress, isStaticAssetRequest, startRequestSession } from "@sentry/core/server";
7
+ import { classifyResponseStreaming, getClientIPAddress, isServedTunnelRequest, isStaticAssetRequest, startRequestSession } from "@sentry/core/server";
7
8
  // src/utils/wrapServerRequestHandler.ts
8
9
  /**
9
10
  * Wraps a handler of a web `Request`, as used by `Deno.serve`, `Bun.serve` and Cloudflare Workers.
@@ -33,7 +34,7 @@ async function wrapServerRequestHandler(config, handler) {
33
34
  ipAddress: socketAddress?.address
34
35
  });
35
36
  isolationScope.setContext("response", null);
36
- if (_INTERNAL_isServedTunnelRequest(request, client)) {
37
+ if (isServedTunnelRequest(request, client)) {
37
38
  let response;
38
39
  try {
39
40
  response = await handler();
@@ -83,7 +84,7 @@ async function wrapServerRequestHandler(config, handler) {
83
84
  if (!createSpan) {
84
85
  let response;
85
86
  try {
86
- response = await handler();
87
+ response = withServerTimingTraceHeader(client, await handler());
87
88
  } catch (e) {
88
89
  captureError(e);
89
90
  finish(void 0);
@@ -121,7 +122,7 @@ async function wrapServerRequestHandler(config, handler) {
121
122
  if (onSpanCreated) safeCallback(DEBUG_BUILD ? "Error in `onSpanCreated`:" : "", () => onSpanCreated(span, request), () => void 0);
122
123
  let response;
123
124
  try {
124
- response = await handler();
125
+ response = withServerTimingTraceHeader(client, await handler());
125
126
  } catch (e) {
126
127
  span.setStatus({
127
128
  code: SPAN_STATUS_ERROR,
@@ -1 +1 @@
1
- {"version":3,"file":"wrapServerRequestHandler.js","names":["isServedTunnelRequest"],"sources":["../../../src/utils/wrapServerRequestHandler.ts"],"sourcesContent":["import {\n CLIENT_ADDRESS,\n CLIENT_PORT,\n HTTP_REQUEST_BODY_SIZE,\n NETWORK_PROTOCOL_NAME,\n SENTRY_KIND,\n SENTRY_OP,\n SENTRY_SEGMENT_NAME_SOURCE,\n USER_AGENT_ORIGINAL,\n} from '@sentry/conventions/attributes';\nimport { HTTP_SERVER } from '@sentry/conventions/op';\nimport type { Client, Mechanism, Scope, SpanAttributes } from '@sentry/core';\nimport {\n captureBodyFromWinterCGRequest,\n captureException,\n continueTrace,\n getCurrentScope,\n getHttpSpanDetailsFromUrlObject,\n hasSpansEnabled,\n hasSpanStreamingEnabled,\n httpHeadersToSpanAttributes,\n HTTP_SPAN_NAME_FALLBACK,\n parseStringToURLObject,\n safeCallback,\n setHttpStatus,\n SPAN_STATUS_ERROR,\n startSpanManual,\n winterCGHeadersToDict,\n winterCGRequestToRequestData,\n withIsolationScope,\n withScope,\n} from '@sentry/core';\nimport type { ServerRequestOptions } from '@sentry/core/server';\nimport {\n _INTERNAL_isServedTunnelRequest as isServedTunnelRequest,\n classifyResponseStreaming,\n getClientIPAddress,\n isStaticAssetRequest,\n startRequestSession,\n} from '@sentry/core/server';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { monitorStream } from './monitorStream';\n\nexport interface ServerRequestHandlerConfig {\n request: Request;\n client: Client;\n /** The isolation scope of this request. */\n isolationScope: Scope;\n /** The options of the runtime's integration for incoming requests. */\n options: ServerRequestOptions<Request, Response> | undefined;\n /** Origin of the span, e.g. `auto.http.deno`. */\n origin: string;\n /** Mechanism of errors that the handler or the response stream throws. Omit to not capture them. */\n mechanism?: Mechanism;\n /** The address and port of the socket, if the runtime knows them. */\n getSocketAddress?: () => { address: string; port?: number } | undefined;\n /** The matched route of the server framework, e.g. `/users/:id`. Sets `http.route` and the span name. */\n routeName?: string;\n /** Span attributes that only the runtime knows, e.g. the route parameters. */\n attributes?: SpanAttributes;\n /**\n * Called in the scope of the continued trace, before the span starts. Lets the runtime continue\n * its own trace, e.g. the trace that Cloudflare exports for the invocation.\n */\n onTraceContinued?: () => void;\n /** Whether the response streams. Return `undefined` to use the default classification. */\n isStreamingResponse?: (response: Response) => boolean | undefined;\n /**\n * Called once when the request is done: when the response is returned, when a streamed body\n * finishes, or when the handler throws (then without a response).\n */\n onDone?: (response: Response | undefined) => void;\n}\n\n/**\n * Wraps a handler of a web `Request`, as used by `Deno.serve`, `Bun.serve` and Cloudflare Workers.\n *\n * It records the request session, attaches the request data and body, continues the incoming\n * trace, creates the `http.server` span, and captures errors that the handler throws. The rules\n * follow core's `node:http` server code:\n *\n * - `OPTIONS` and `HEAD` requests get no span and no body capture.\n * - The static asset filter applies only to `GET`.\n * - The span and the session of a streamed response end when the stream finishes.\n *\n * The handler can return no response, as Bun's `fetch` does after a WebSocket upgrade.\n */\nexport async function wrapServerRequestHandler<R extends Response | undefined = Response>(\n config: ServerRequestHandlerConfig,\n handler: () => R | Promise<R>,\n): Promise<R> {\n const { request, client, isolationScope, options, mechanism } = config;\n\n const method = request.method.toUpperCase();\n const captureError = (error: unknown): void => {\n if (mechanism) {\n captureException(error, { mechanism });\n }\n };\n\n const socketAddress = config.getSocketAddress?.();\n // Without `AsyncLocalStorage`, all requests share one isolation scope, so clear what an earlier\n // request left on it: the merge keeps its body, and its response context would stay set.\n isolationScope.setSDKProcessingMetadata({\n normalizedRequest: { ...winterCGRequestToRequestData(request), data: undefined },\n ipAddress: socketAddress?.address,\n });\n isolationScope.setContext('response', null);\n\n // Tunnel requests get no session, body or span, whether the SDK or the app answers them. The app answers them with\n // `intercept: false`, from its own code, so its errors are still captured.\n if (isServedTunnelRequest(request, client)) {\n let response: R | undefined;\n try {\n response = await handler();\n return response;\n } catch (e) {\n captureError(e);\n throw e;\n } finally {\n config.onDone?.(response);\n }\n }\n\n const endSession = options?.sessions\n ? startRequestSession(client, {\n requestIsolationScope: isolationScope,\n sessionFlushingDelayMS: options.sessionFlushingDelayMS,\n })\n : undefined;\n const finish = (response: Response | undefined): void => {\n endSession?.();\n config.onDone?.(response);\n };\n const isStreamingResponse = (response: Response): boolean => {\n const classification = config.isStreamingResponse?.(response);\n return typeof classification === 'boolean' ? classification : classifyResponseStreaming(response).isStreaming;\n };\n\n if (method === 'OPTIONS' || method === 'HEAD') {\n let response: R | undefined;\n try {\n response = await handler();\n return response;\n } catch (e) {\n captureError(e);\n throw e;\n } finally {\n finish(response);\n }\n }\n\n const dataCollection = client.getDataCollectionOptions();\n const effectiveBodySize =\n options?.maxRequestBodySize ?? (dataCollection.httpBodies.includes('incomingRequest') ? 'medium' : 'none');\n const ignoreRequestBody = options?.ignoreRequestBody;\n if (\n method !== 'GET' &&\n effectiveBodySize !== 'none' &&\n // If the filter throws, skip the body so it cannot leak data the filter was meant to hide.\n !(\n ignoreRequestBody &&\n safeCallback(\n DEBUG_BUILD ? 'Error in `ignoreRequestBody`, skipping the body:' : '',\n () => ignoreRequestBody(request.url, request),\n () => true,\n )\n )\n ) {\n await captureBodyFromWinterCGRequest(request, isolationScope, effectiveBodySize);\n }\n\n const urlObject = parseStringToURLObject(request.url);\n const urlPath = urlObject ? `${urlObject.pathname}${urlObject.search}` : '/';\n const createSpan = shouldCreateSpan(client, options, request, urlPath);\n\n return continueTrace(\n {\n sentryTrace: request.headers.get('sentry-trace') || '',\n baggage: request.headers.get('baggage'),\n },\n async () => {\n config.onTraceContinued?.();\n\n if (!createSpan) {\n let response: R;\n try {\n response = await handler();\n } catch (e) {\n captureError(e);\n finish(undefined);\n throw e;\n }\n if (response) {\n isolationScope.setContext('response', { status_code: response.status });\n }\n const inRequestScope = bindToRequestScope(isolationScope);\n return onResponseDone(\n response,\n !!response && isStreamingResponse(response),\n inRequestScope(() => finish(response)),\n inRequestScope(captureError),\n );\n }\n\n const [rawName, attributes] = getHttpSpanDetailsFromUrlObject(\n urlObject,\n 'server',\n config.origin,\n request,\n config.routeName,\n client,\n );\n // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.\n // A `route` source means the name already is (e.g. the `/` path), so it is kept as-is.\n const name =\n attributes[SENTRY_SEGMENT_NAME_SOURCE] === 'route' || !hasSpanStreamingEnabled(client)\n ? rawName\n : method || HTTP_SPAN_NAME_FALLBACK;\n\n const contentLength = request.headers.get('content-length');\n if (contentLength) {\n attributes[HTTP_REQUEST_BODY_SIZE] = parseInt(contentLength, 10);\n }\n const userAgent = request.headers.get('user-agent');\n if (userAgent) {\n attributes[USER_AGENT_ORIGINAL] = userAgent;\n }\n\n const headers = winterCGHeadersToDict(request.headers);\n if (dataCollection.userInfo) {\n // `client.address` is the originating client, so a forwarding header wins over the socket, which\n // behind a proxy holds the proxy's address. The socket port is the proxy's too, so `client.port`\n // stays unset then.\n const forwardedAddress = getClientIPAddress(headers);\n if (forwardedAddress) {\n attributes[CLIENT_ADDRESS] = forwardedAddress;\n } else if (socketAddress) {\n attributes[CLIENT_ADDRESS] = socketAddress.address;\n if (socketAddress.port !== undefined) {\n attributes[CLIENT_PORT] = socketAddress.port;\n }\n }\n }\n\n // describes the OSI application-layer protocol (http), not the scheme (might be https)\n attributes[NETWORK_PROTOCOL_NAME] = 'http';\n Object.assign(attributes, httpHeadersToSpanAttributes(headers, dataCollection));\n Object.assign(attributes, config.attributes);\n attributes[SENTRY_OP] = HTTP_SERVER;\n attributes[SENTRY_KIND] = 'server';\n\n return startSpanManual({ name, attributes }, async span => {\n const { onSpanCreated, onSpanEnd } = options ?? {};\n if (onSpanCreated) {\n safeCallback(\n DEBUG_BUILD ? 'Error in `onSpanCreated`:' : '',\n () => onSpanCreated(span, request),\n () => undefined,\n );\n }\n\n let response: R;\n try {\n response = await handler();\n } catch (e) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n span.end();\n captureError(e);\n finish(undefined);\n throw e;\n }\n\n if (response) {\n setHttpStatus(span, response.status);\n isolationScope.setContext('response', { status_code: response.status });\n span.setAttributes(\n httpHeadersToSpanAttributes(responseHeadersToDict(response.headers), dataCollection, 'response'),\n );\n }\n\n const inRequestScope = bindToRequestScope(isolationScope);\n return onResponseDone(\n response,\n !!response && isStreamingResponse(response),\n inRequestScope(() => {\n if (onSpanEnd && response) {\n safeCallback(\n DEBUG_BUILD ? 'Error in `onSpanEnd`:' : '',\n () => onSpanEnd(span, request, response),\n () => undefined,\n );\n }\n span.end();\n finish(response);\n }),\n inRequestScope((error: unknown) => {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureError(error);\n }),\n );\n });\n },\n );\n}\n\n/**\n * Returns a function that binds a callback to the request's isolation scope and the current scope.\n *\n * A streamed body finishes after the handler returns. Without `AsyncLocalStorage` (Cloudflare\n * Workers without `nodejs_compat`), its callbacks then run outside the request's scopes, where\n * `getClient()` finds no client: the segment span would be sent as a transaction, and a captured\n * error would not update the request session.\n */\nfunction bindToRequestScope(\n isolationScope: Scope,\n): <A extends unknown[]>(fn: (...args: A) => void) => (...args: A) => void {\n const scope = getCurrentScope();\n return fn =>\n (...args) =>\n withIsolationScope(isolationScope, () => withScope(scope, () => fn(...args)));\n}\n\nfunction shouldCreateSpan(\n client: Client,\n options: ServerRequestOptions<Request, Response> | undefined,\n request: Request,\n urlPath: string,\n): boolean {\n if (!(options?.spans ?? hasSpansEnabled(client.getOptions()))) {\n return false;\n }\n if (options?.ignoreStaticAssets && request.method.toUpperCase() === 'GET' && isStaticAssetRequest(urlPath)) {\n return false;\n }\n const ignoreIncomingRequests = options?.ignoreIncomingRequests;\n return !(\n ignoreIncomingRequests &&\n safeCallback(\n DEBUG_BUILD ? 'Error in `ignoreIncomingRequests`, creating the span:' : '',\n () => ignoreIncomingRequests(urlPath, request),\n () => false,\n )\n );\n}\n\n/**\n * Calls `onDone` when the response is done: at once, or when a streamed body finishes.\n * Returns the response to send.\n */\nfunction onResponseDone<R extends Response | undefined>(\n response: R,\n isStreaming: boolean,\n onDone: () => void,\n onStreamError: (error: unknown) => void,\n): R {\n if (isStreaming && response?.body && !response.body.locked) {\n try {\n // Passing the original response as the init keeps its status, status text and headers, and\n // on Cloudflare also `encodeBody: 'manual'`, so workerd does not compress a compressed body again.\n return new Response(monitorStream(response.body, onDone, onStreamError), response) as R;\n } catch {\n // Workers with a compatibility date before 2022-11-30 and without the\n // `streams_enable_constructors` flag cannot construct a `ReadableStream`, so end at once.\n }\n }\n onDone();\n return response;\n}\n\n// `Headers.forEach` lists each `Set-Cookie` header on its own, so a plain dict keeps only the last one.\nfunction responseHeadersToDict(headers: Headers): Record<string, string | string[]> {\n const dict: Record<string, string | string[]> = winterCGHeadersToDict(headers);\n const setCookie = typeof headers.getSetCookie === 'function' ? headers.getSetCookie() : [];\n if (setCookie.length) {\n dict['set-cookie'] = setCookie;\n }\n return dict;\n}\n"],"mappings":";;;;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;;;AAUA,SAAS,mBACP,gBACyE;CACzE,MAAM,QAAQ,gBAAgB;CAC9B,QAAO,QACJ,GAAG,SACF,mBAAmB,sBAAsB,UAAU,aAAa,GAAG,GAAG,IAAI,CAAC,CAAC;AAClF;AAEA,SAAS,iBACP,QACA,SACA,SACA,SACS;CACT,IAAI,EAAE,SAAS,SAAS,gBAAgB,OAAO,WAAW,CAAC,IACzD,OAAO;CAET,IAAI,SAAS,sBAAsB,QAAQ,OAAO,YAAY,MAAM,SAAS,qBAAqB,OAAO,GACvG,OAAO;CAET,MAAM,yBAAyB,SAAS;CACxC,OAAO,EACL,0BACA,aACE,cAAc,0DAA0D,UAClE,uBAAuB,SAAS,OAAO,SACvC,KACR;AAEJ;;;;;AAMA,SAAS,eACP,UACA,aACA,QACA,eACG;CACH,IAAI,eAAe,UAAU,QAAQ,CAAC,SAAS,KAAK,QAClD,IAAI;EAGF,OAAO,IAAI,SAAS,cAAc,SAAS,MAAM,QAAQ,aAAa,GAAG,QAAQ;CACnF,QAAQ,CAGR;CAEF,OAAO;CACP,OAAO;AACT;AAGA,SAAS,sBAAsB,SAAqD;CAClF,MAAM,OAA0C,sBAAsB,OAAO;CAC7E,MAAM,YAAY,OAAO,QAAQ,iBAAiB,aAAa,QAAQ,aAAa,IAAI,CAAC;CACzF,IAAI,UAAU,QACZ,KAAK,gBAAgB;CAEvB,OAAO;AACT"}
1
+ {"version":3,"file":"wrapServerRequestHandler.js","names":[],"sources":["../../../src/utils/wrapServerRequestHandler.ts"],"sourcesContent":["import {\n CLIENT_ADDRESS,\n CLIENT_PORT,\n HTTP_REQUEST_BODY_SIZE,\n NETWORK_PROTOCOL_NAME,\n SENTRY_KIND,\n SENTRY_OP,\n SENTRY_SEGMENT_NAME_SOURCE,\n USER_AGENT_ORIGINAL,\n} from '@sentry/conventions/attributes';\nimport { HTTP_SERVER } from '@sentry/conventions/op';\nimport type { Client, Mechanism, Scope, SpanAttributes } from '@sentry/core';\nimport {\n captureBodyFromWinterCGRequest,\n captureException,\n continueTrace,\n getCurrentScope,\n getHttpSpanDetailsFromUrlObject,\n hasSpansEnabled,\n hasSpanStreamingEnabled,\n httpHeadersToSpanAttributes,\n HTTP_SPAN_NAME_FALLBACK,\n parseStringToURLObject,\n safeCallback,\n setHttpStatus,\n SPAN_STATUS_ERROR,\n startSpanManual,\n winterCGHeadersToDict,\n winterCGRequestToRequestData,\n withIsolationScope,\n withScope,\n} from '@sentry/core';\nimport type { ServerRequestOptions } from '@sentry/core/server';\nimport {\n isServedTunnelRequest,\n classifyResponseStreaming,\n getClientIPAddress,\n isStaticAssetRequest,\n startRequestSession,\n} from '@sentry/core/server';\nimport { DEBUG_BUILD } from '../debug-build';\nimport { monitorStream } from './monitorStream';\nimport { withServerTimingTraceHeader } from './serverTimingTraceHeader';\n\nexport interface ServerRequestHandlerConfig {\n request: Request;\n client: Client;\n /** The isolation scope of this request. */\n isolationScope: Scope;\n /** The options of the runtime's integration for incoming requests. */\n options: ServerRequestOptions<Request, Response> | undefined;\n /** Origin of the span, e.g. `auto.http.deno`. */\n origin: string;\n /** Mechanism of errors that the handler or the response stream throws. Omit to not capture them. */\n mechanism?: Mechanism;\n /** The address and port of the socket, if the runtime knows them. */\n getSocketAddress?: () => { address: string; port?: number } | undefined;\n /** The matched route of the server framework, e.g. `/users/:id`. Sets `http.route` and the span name. */\n routeName?: string;\n /** Span attributes that only the runtime knows, e.g. the route parameters. */\n attributes?: SpanAttributes;\n /**\n * Called in the scope of the continued trace, before the span starts. Lets the runtime continue\n * its own trace, e.g. the trace that Cloudflare exports for the invocation.\n */\n onTraceContinued?: () => void;\n /** Whether the response streams. Return `undefined` to use the default classification. */\n isStreamingResponse?: (response: Response) => boolean | undefined;\n /**\n * Called once when the request is done: when the response is returned, when a streamed body\n * finishes, or when the handler throws (then without a response).\n */\n onDone?: (response: Response | undefined) => void;\n}\n\n/**\n * Wraps a handler of a web `Request`, as used by `Deno.serve`, `Bun.serve` and Cloudflare Workers.\n *\n * It records the request session, attaches the request data and body, continues the incoming\n * trace, creates the `http.server` span, and captures errors that the handler throws. The rules\n * follow core's `node:http` server code:\n *\n * - `OPTIONS` and `HEAD` requests get no span and no body capture.\n * - The static asset filter applies only to `GET`.\n * - The span and the session of a streamed response end when the stream finishes.\n *\n * The handler can return no response, as Bun's `fetch` does after a WebSocket upgrade.\n */\nexport async function wrapServerRequestHandler<R extends Response | undefined = Response>(\n config: ServerRequestHandlerConfig,\n handler: () => R | Promise<R>,\n): Promise<R> {\n const { request, client, isolationScope, options, mechanism } = config;\n\n const method = request.method.toUpperCase();\n const captureError = (error: unknown): void => {\n if (mechanism) {\n captureException(error, { mechanism });\n }\n };\n\n const socketAddress = config.getSocketAddress?.();\n // Without `AsyncLocalStorage`, all requests share one isolation scope, so clear what an earlier\n // request left on it: the merge keeps its body, and its response context would stay set.\n isolationScope.setSDKProcessingMetadata({\n normalizedRequest: { ...winterCGRequestToRequestData(request), data: undefined },\n ipAddress: socketAddress?.address,\n });\n isolationScope.setContext('response', null);\n\n // Tunnel requests get no session, body or span, whether the SDK or the app answers them. The app answers them with\n // `intercept: false`, from its own code, so its errors are still captured.\n if (isServedTunnelRequest(request, client)) {\n let response: R | undefined;\n try {\n response = await handler();\n return response;\n } catch (e) {\n captureError(e);\n throw e;\n } finally {\n config.onDone?.(response);\n }\n }\n\n const endSession = options?.sessions\n ? startRequestSession(client, {\n requestIsolationScope: isolationScope,\n sessionFlushingDelayMS: options.sessionFlushingDelayMS,\n })\n : undefined;\n const finish = (response: Response | undefined): void => {\n endSession?.();\n config.onDone?.(response);\n };\n const isStreamingResponse = (response: Response): boolean => {\n const classification = config.isStreamingResponse?.(response);\n return typeof classification === 'boolean' ? classification : classifyResponseStreaming(response).isStreaming;\n };\n\n if (method === 'OPTIONS' || method === 'HEAD') {\n let response: R | undefined;\n try {\n response = await handler();\n return response;\n } catch (e) {\n captureError(e);\n throw e;\n } finally {\n finish(response);\n }\n }\n\n const dataCollection = client.getDataCollectionOptions();\n const effectiveBodySize =\n options?.maxRequestBodySize ?? (dataCollection.httpBodies.includes('incomingRequest') ? 'medium' : 'none');\n const ignoreRequestBody = options?.ignoreRequestBody;\n if (\n method !== 'GET' &&\n effectiveBodySize !== 'none' &&\n // If the filter throws, skip the body so it cannot leak data the filter was meant to hide.\n !(\n ignoreRequestBody &&\n safeCallback(\n DEBUG_BUILD ? 'Error in `ignoreRequestBody`, skipping the body:' : '',\n () => ignoreRequestBody(request.url, request),\n () => true,\n )\n )\n ) {\n await captureBodyFromWinterCGRequest(request, isolationScope, effectiveBodySize);\n }\n\n const urlObject = parseStringToURLObject(request.url);\n const urlPath = urlObject ? `${urlObject.pathname}${urlObject.search}` : '/';\n const createSpan = shouldCreateSpan(client, options, request, urlPath);\n\n return continueTrace(\n {\n sentryTrace: request.headers.get('sentry-trace') || '',\n baggage: request.headers.get('baggage'),\n },\n async () => {\n config.onTraceContinued?.();\n\n if (!createSpan) {\n let response: R;\n try {\n response = withServerTimingTraceHeader(client, await handler());\n } catch (e) {\n captureError(e);\n finish(undefined);\n throw e;\n }\n if (response) {\n isolationScope.setContext('response', { status_code: response.status });\n }\n const inRequestScope = bindToRequestScope(isolationScope);\n return onResponseDone(\n response,\n !!response && isStreamingResponse(response),\n inRequestScope(() => finish(response)),\n inRequestScope(captureError),\n );\n }\n\n const [rawName, attributes] = getHttpSpanDetailsFromUrlObject(\n urlObject,\n 'server',\n config.origin,\n request,\n config.routeName,\n client,\n );\n // With span streaming, span names have to be low cardinality, so we can't fall back to the URL.\n // A `route` source means the name already is (e.g. the `/` path), so it is kept as-is.\n const name =\n attributes[SENTRY_SEGMENT_NAME_SOURCE] === 'route' || !hasSpanStreamingEnabled(client)\n ? rawName\n : method || HTTP_SPAN_NAME_FALLBACK;\n\n const contentLength = request.headers.get('content-length');\n if (contentLength) {\n attributes[HTTP_REQUEST_BODY_SIZE] = parseInt(contentLength, 10);\n }\n const userAgent = request.headers.get('user-agent');\n if (userAgent) {\n attributes[USER_AGENT_ORIGINAL] = userAgent;\n }\n\n const headers = winterCGHeadersToDict(request.headers);\n if (dataCollection.userInfo) {\n // `client.address` is the originating client, so a forwarding header wins over the socket, which\n // behind a proxy holds the proxy's address. The socket port is the proxy's too, so `client.port`\n // stays unset then.\n const forwardedAddress = getClientIPAddress(headers);\n if (forwardedAddress) {\n attributes[CLIENT_ADDRESS] = forwardedAddress;\n } else if (socketAddress) {\n attributes[CLIENT_ADDRESS] = socketAddress.address;\n if (socketAddress.port !== undefined) {\n attributes[CLIENT_PORT] = socketAddress.port;\n }\n }\n }\n\n // describes the OSI application-layer protocol (http), not the scheme (might be https)\n attributes[NETWORK_PROTOCOL_NAME] = 'http';\n Object.assign(attributes, httpHeadersToSpanAttributes(headers, dataCollection));\n Object.assign(attributes, config.attributes);\n attributes[SENTRY_OP] = HTTP_SERVER;\n attributes[SENTRY_KIND] = 'server';\n\n return startSpanManual({ name, attributes }, async span => {\n const { onSpanCreated, onSpanEnd } = options ?? {};\n if (onSpanCreated) {\n safeCallback(\n DEBUG_BUILD ? 'Error in `onSpanCreated`:' : '',\n () => onSpanCreated(span, request),\n () => undefined,\n );\n }\n\n let response: R;\n try {\n response = withServerTimingTraceHeader(client, await handler());\n } catch (e) {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n span.end();\n captureError(e);\n finish(undefined);\n throw e;\n }\n\n if (response) {\n setHttpStatus(span, response.status);\n isolationScope.setContext('response', { status_code: response.status });\n span.setAttributes(\n httpHeadersToSpanAttributes(responseHeadersToDict(response.headers), dataCollection, 'response'),\n );\n }\n\n const inRequestScope = bindToRequestScope(isolationScope);\n return onResponseDone(\n response,\n !!response && isStreamingResponse(response),\n inRequestScope(() => {\n if (onSpanEnd && response) {\n safeCallback(\n DEBUG_BUILD ? 'Error in `onSpanEnd`:' : '',\n () => onSpanEnd(span, request, response),\n () => undefined,\n );\n }\n span.end();\n finish(response);\n }),\n inRequestScope((error: unknown) => {\n span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' });\n captureError(error);\n }),\n );\n });\n },\n );\n}\n\n/**\n * Returns a function that binds a callback to the request's isolation scope and the current scope.\n *\n * A streamed body finishes after the handler returns. Without `AsyncLocalStorage` (Cloudflare\n * Workers without `nodejs_compat`), its callbacks then run outside the request's scopes, where\n * `getClient()` finds no client: the segment span would be sent as a transaction, and a captured\n * error would not update the request session.\n */\nfunction bindToRequestScope(\n isolationScope: Scope,\n): <A extends unknown[]>(fn: (...args: A) => void) => (...args: A) => void {\n const scope = getCurrentScope();\n return fn =>\n (...args) =>\n withIsolationScope(isolationScope, () => withScope(scope, () => fn(...args)));\n}\n\nfunction shouldCreateSpan(\n client: Client,\n options: ServerRequestOptions<Request, Response> | undefined,\n request: Request,\n urlPath: string,\n): boolean {\n if (!(options?.spans ?? hasSpansEnabled(client.getOptions()))) {\n return false;\n }\n if (options?.ignoreStaticAssets && request.method.toUpperCase() === 'GET' && isStaticAssetRequest(urlPath)) {\n return false;\n }\n const ignoreIncomingRequests = options?.ignoreIncomingRequests;\n return !(\n ignoreIncomingRequests &&\n safeCallback(\n DEBUG_BUILD ? 'Error in `ignoreIncomingRequests`, creating the span:' : '',\n () => ignoreIncomingRequests(urlPath, request),\n () => false,\n )\n );\n}\n\n/**\n * Calls `onDone` when the response is done: at once, or when a streamed body finishes.\n * Returns the response to send.\n */\nfunction onResponseDone<R extends Response | undefined>(\n response: R,\n isStreaming: boolean,\n onDone: () => void,\n onStreamError: (error: unknown) => void,\n): R {\n if (isStreaming && response?.body && !response.body.locked) {\n try {\n // Passing the original response as the init keeps its status, status text and headers, and\n // on Cloudflare also `encodeBody: 'manual'`, so workerd does not compress a compressed body again.\n return new Response(monitorStream(response.body, onDone, onStreamError), response) as R;\n } catch {\n // Workers with a compatibility date before 2022-11-30 and without the\n // `streams_enable_constructors` flag cannot construct a `ReadableStream`, so end at once.\n }\n }\n onDone();\n return response;\n}\n\n// `Headers.forEach` lists each `Set-Cookie` header on its own, so a plain dict keeps only the last one.\nfunction responseHeadersToDict(headers: Headers): Record<string, string | string[]> {\n const dict: Record<string, string | string[]> = winterCGHeadersToDict(headers);\n const setCookie = typeof headers.getSetCookie === 'function' ? headers.getSetCookie() : [];\n if (setCookie.length) {\n dict['set-cookie'] = setCookie;\n }\n return dict;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwFA,eAAsB,yBACpB,QACA,SACY;CACZ,MAAM,EAAE,SAAS,QAAQ,gBAAgB,SAAS,cAAc;CAEhE,MAAM,SAAS,QAAQ,OAAO,YAAY;CAC1C,MAAM,gBAAgB,UAAyB;EAC7C,IAAI,WACF,iBAAiB,OAAO,EAAE,UAAU,CAAC;CAEzC;CAEA,MAAM,gBAAgB,OAAO,mBAAmB;CAGhD,eAAe,yBAAyB;EACtC,mBAAmB;GAAE,GAAG,6BAA6B,OAAO;GAAG,MAAM,KAAA;EAAU;EAC/E,WAAW,eAAe;CAC5B,CAAC;CACD,eAAe,WAAW,YAAY,IAAI;CAI1C,IAAI,sBAAsB,SAAS,MAAM,GAAG;EAC1C,IAAI;EACJ,IAAI;GACF,WAAW,MAAM,QAAQ;GACzB,OAAO;EACT,SAAS,GAAG;GACV,aAAa,CAAC;GACd,MAAM;EACR,UAAU;GACR,OAAO,SAAS,QAAQ;EAC1B;CACF;CAEA,MAAM,aAAa,SAAS,WACxB,oBAAoB,QAAQ;EAC1B,uBAAuB;EACvB,wBAAwB,QAAQ;CAClC,CAAC,IACD,KAAA;CACJ,MAAM,UAAU,aAAyC;EACvD,aAAa;EACb,OAAO,SAAS,QAAQ;CAC1B;CACA,MAAM,uBAAuB,aAAgC;EAC3D,MAAM,iBAAiB,OAAO,sBAAsB,QAAQ;EAC5D,OAAO,OAAO,mBAAmB,YAAY,iBAAiB,0BAA0B,QAAQ,CAAC,CAAC;CACpG;CAEA,IAAI,WAAW,aAAa,WAAW,QAAQ;EAC7C,IAAI;EACJ,IAAI;GACF,WAAW,MAAM,QAAQ;GACzB,OAAO;EACT,SAAS,GAAG;GACV,aAAa,CAAC;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["../../../../src/ai/mistral/streaming.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAwB1D,KAAK,mBAAmB,GAAG;IAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,aAAa,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC;AAepF,uDAAuD;AACvD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAE5E;AAmLD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,OAAO,EACtB,WAAW,CAAC,EAAE,WAAW,EACzB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,IAAI,GACvD,OAAO,CAgGT"}
1
+ {"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../../../../src/ai/mistral/streaming.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAwB1D,KAAK,mBAAmB,GAAG;IAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,MAAM,aAAa,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC;AAepF,uDAAuD;AACvD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,mBAAmB,CAE5E;AAoLD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,IAAI,EACV,aAAa,EAAE,OAAO,EACtB,WAAW,CAAC,EAAE,WAAW,EACzB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC,KAAK,IAAI,GACvD,OAAO,CAgGT"}
@@ -5,6 +5,7 @@ export * from './ai';
5
5
  export { getSqlQuerySummary, sanitizeSqlQuery, getSqlQueryAttributes, getSqlSpanName } from './utils/sql';
6
6
  export type { SqlDialect } from './utils/sql';
7
7
  export { isBun, isCloudflareWorkers, isDeno } from './utils/runtime';
8
+ export { collectInstalledModules } from './utils/installedModules';
8
9
  export { instrumentPostgresJsSql } from './integrations/postgresjs-wrapper';
9
10
  export type { PostgresConnectionContext } from './integrations/postgresjs-wrapper';
10
11
  export { applyHonoPatches, earlyPatchHono } from './integrations/hono/applyPatches';
@@ -1 +1 @@
1
- {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAE,wCAAwC,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAClF,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1G,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,YAAY,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAMnF,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,YAAY,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AACnG,YAAY,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC"}
1
+ {"version":3,"file":"exports.d.ts","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;AAC1F,OAAO,EAAE,wCAAwC,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAClF,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC1G,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,YAAY,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAMnF,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACpF,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,YAAY,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAC;AACnG,YAAY,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC"}
@@ -48,8 +48,9 @@ export { piDurableIntegration } from './integrations/pi-durable';
48
48
  export type { FlueOptions } from './ai/flue';
49
49
  export { mastraIntegration } from './integrations/mastra';
50
50
  export { mcpServerIntegration } from './integrations/mcp-server';
51
- export { instrumentTunnelServers as _INTERNAL_instrumentTunnelServers, makeServeTunnelIntegration, } from './integrations/serveTunnel';
52
- export { instrumentTunnelServer as _INTERNAL_instrumentTunnelServer } from './utils/tunnelServer';
51
+ export { instrumentTunnelServers, makeServeTunnelIntegration } from './integrations/serveTunnel';
52
+ export { instrumentTunnelServer } from './utils/tunnelServer';
53
+ export { createGetModuleFromFilename } from './utils/module';
53
54
  export { SentryMastraExporter } from './ai/mastra';
54
55
  export { lruMemoizerIntegration } from './integrations/lru-memoizer';
55
56
  export { mongoIntegration } from './integrations/mongodb';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAG1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,IAAI,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAC3G,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AACvE,YAAY,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AACpE,YAAY,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAKrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EACL,SAAS,IAAI,2BAA2B,EACxC,cAAc,IAAI,yBAAyB,GAC5C,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EACL,kBAAkB,EAElB,wBAAwB,GACzB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,sBAAsB,gCAA0B,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC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} from './utils/wrapServerRequestHandler';
2
2
  export type { ServerRequestHandlerConfig } from './utils/wrapServerRequestHandler';
3
+ export { addServerTimingTraceHeader } from './utils/serverTimingTraceHeader';
3
4
  //# sourceMappingURL=index.request-handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.request-handler.d.ts","sourceRoot":"","sources":["../../src/index.request-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,YAAY,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC"}
1
+ {"version":3,"file":"index.request-handler.d.ts","sourceRoot":"","sources":["../../src/index.request-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,YAAY,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"amqplib.d.ts","sourceRoot":"","sources":["../../../src/integrations/amqplib.ts"],"names":[],"mappings":"AA4mBA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGnH;AAoCD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;CAAyC,CAAC"}
1
+ {"version":3,"file":"amqplib.d.ts","sourceRoot":"","sources":["../../../src/integrations/amqplib.ts"],"names":[],"mappings":"AA8mBA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGnH;AAoCD;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;CAAyC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/integrations/anthropic.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAuB,kBAAkB,EAAuB,MAAM,0BAA0B,CAAC;AA2R7G;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;CAA6C,CAAC"}
1
+ {"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../../src/integrations/anthropic.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAuB,kBAAkB,EAAuB,MAAM,0BAA0B,CAAC;AA6R7G;;;;GAIG;AACH,eAAO,MAAM,sBAAsB;;CAA6C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../../../src/integrations/bullmq/tracer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAuCjF,qBAAa,kBAAmB,YAAW,MAAM,CAAC,aAAa,CAAC;IACvD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,aAAa,CAiC5F;CACF"}
1
+ {"version":3,"file":"tracer.d.ts","sourceRoot":"","sources":["../../../../src/integrations/bullmq/tracer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAwCjF,qBAAa,kBAAmB,YAAW,MAAM,CAAC,aAAa,CAAC;IACvD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,aAAa,CAiC5F;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"hapi-utils.d.ts","sourceRoot":"","sources":["../../../../src/integrations/hapi/hapi-utils.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACV,WAAW,EAOX,oBAAoB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C;CACd;AA0BD,2DAA2D;AAC3D,eAAO,MAAM,gBAAgB,kCAI1B;IACD,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,KAAG,YAwBH,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,cAAc,aACf,oBAAoB,eACjB,MAAM,eACN,MAAM,KAClB,YAoBF,CAAC;AAkGF;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAS7E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAuB3E"}
@@ -1 +1 @@
1
- {"version":3,"file":"isMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/integrations/hono/isMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAO7C;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAStD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAQjE"}
1
+ {"version":3,"file":"isMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/integrations/hono/isMiddleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAQ7C;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAStD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,EAAE,CAQjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"middlewareHandlers.d.ts","sourceRoot":"","sources":["../../../../src/integrations/hono/middlewareHandlers.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,YAAY,CAAC;AAM5D,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAW3D;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA0B3E;AAgED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,iBAAiB,CAAC,EAAE,2BAA2B,CAAC,mBAAmB,CAAC,GACnE,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,iBAAiB,CAAC,EAAE,2BAA2B,CAAC,mBAAmB,CAAC,GACnE,IAAI,CAQN"}
1
+ {"version":3,"file":"middlewareHandlers.d.ts","sourceRoot":"","sources":["../../../../src/integrations/hono/middlewareHandlers.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,YAAY,CAAC;AAM5D,OAAO,EAAE,KAAK,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAY3D;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CA0B3E;AAgED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,iBAAiB,CAAC,EAAE,2BAA2B,CAAC,mBAAmB,CAAC,GACnE,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,iBAAiB,CAAC,EAAE,2BAA2B,CAAC,mBAAmB,CAAC,GACnE,IAAI,CASN"}
@@ -1 +1 @@
1
- {"version":3,"file":"patchRoute.d.ts","sourceRoot":"","sources":["../../../../src/integrations/hono/patchRoute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMnD,YAAY,EAAE,SAAS,EAAE,CAAC;AAG1B,KAAK,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AAEzB,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;IAChD,mBAAmB,CAAC,EAAE,eAAe,CAAC;CACvC,CAAC;AAiCF;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,aAAa,GAAG,eAAe,CAgCzF;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAO9D"}
1
+ {"version":3,"file":"patchRoute.d.ts","sourceRoot":"","sources":["../../../../src/integrations/hono/patchRoute.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAMnD,YAAY,EAAE,SAAS,EAAE,CAAC;AAG1B,KAAK,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;AAEzB,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,iBAAiB,EAAE,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC;IAChD,mBAAmB,CAAC,EAAE,eAAe,CAAC;CACvC,CAAC;AAiCF;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,aAAa,GAAG,eAAe,CAgCzF;AAMD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAO9D"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns the value that a handler threw, so that `shouldHandleError` and the event get that value
3
+ * and not Hono's wrapper.
4
+ *
5
+ * Hono 5 wraps a thrown non-Error before its error handlers run:
6
+ * `new Error(typeof err === 'string' ? err : undefined, { cause: err })`.
7
+ * The wrapper has no marker, so it is found by its shape. A user error with the same shape is also unwrapped.
8
+ */
9
+ export declare function unwrapThrownValue(error: unknown): unknown;
10
+ //# sourceMappingURL=unwrapThrownValue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrapThrownValue.d.ts","sourceRoot":"","sources":["../../../../src/integrations/hono/unwrapThrownValue.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAYzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"mongodb-span.d.ts","sourceRoot":"","sources":["../../../../src/integrations/mongodb/mongodb-span.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAKzD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,SAAS;IACjB,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,CAAC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,EAAE,IAAI,GAAG,MAAM,CAMzC;IAEM,mBAAmB,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAOpD;IAED;;;;;OAKG;IACI,gBAAgB,CAAC,eAAe,EAAE,iBAAiB,GAAG,IAAI,CAehE;IAEM,gBAAgB,IAAI,IAAI,GAAG,SAAS,CAE1C;IAEM,cAAc,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,GAAG,mBAAmB,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,CAqClG;CACF;AAmFD,mFAAmF;AACnF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,OAAO,CAEhG"}
@@ -0,0 +1,27 @@
1
+ /** Maps the AI SDK `experimental_extract` input and output to the Clairic shape of the `gen_ai.extract` schemas. */
2
+ interface ExtractState {
3
+ request: {
4
+ state?: string;
5
+ images?: string[];
6
+ documents?: string[];
7
+ };
8
+ /** For each AI SDK state part, the offset of its text in `request.state`, or `'image'` for an image part. */
9
+ parts: (number | 'image' | undefined)[];
10
+ }
11
+ /**
12
+ * Clairic takes the text as one `state` string, with images and PDF documents in their own arrays. The AI SDK
13
+ * also takes a JSON object, or an array of text, JSON and file parts. Join the text of the parts and keep the
14
+ * offset of each part, so that the answer spans point into the joined `state`.
15
+ */
16
+ export declare function toExtractState(state: unknown): ExtractState;
17
+ /**
18
+ * The AI SDK also takes JSON or `null` as field `instructions`, but the schema allows only a string.
19
+ */
20
+ export declare function toExtractFields(fields: unknown): unknown;
21
+ /**
22
+ * The AI SDK normalizes the provider's extraction answers. Map them back to the provider shape of
23
+ * `gen_ai.output.messages` on `gen_ai.extract` spans. The AI SDK does not expose `truncated`.
24
+ */
25
+ export declare function toExtractAnswers(answers: Record<string, unknown>, parts: ExtractState['parts']): Record<string, unknown>;
26
+ export {};
27
+ //# sourceMappingURL=extract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../../src/integrations/vercel-ai/extract.ts"],"names":[],"mappings":"AAAA,oHAAoH;AAapH,UAAU,YAAY;IACpB,OAAO,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACrE,6GAA6G;IAC7G,KAAK,EAAE,CAAC,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAAE,CAAC;CACzC;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAoC3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAOxD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,GAC3B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsBzB"}
@@ -28,4 +28,6 @@ export { isReadableStream } from '../../ai/core/utils';
28
28
  * mid-stream failure would be worse than a slightly-less-enriched one.
29
29
  */
30
30
  export declare function tapModelCallStream(span: Span, stream: ReadableStream<unknown>, onFinal: (result: StreamedModelCallResult) => void, onError: (error: unknown) => void): ReadableStream<unknown>;
31
+ /** Maps each object value of `record` and keeps the other values as they are. */
32
+ export declare function mapObjectValues(record: Record<string, unknown>, fn: (value: Record<string, unknown>, key: string) => unknown): Record<string, unknown>;
31
33
  //# sourceMappingURL=util.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../src/integrations/vercel-ai/util.ts"],"names":[],"mappings":"AAAA,iHAAiH;AAEjH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIzC,4DAA4D;AAC5D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;AACrF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAE3D;AAED,kHAAkH;AAClH,wBAAgB,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAEpF;AAoCD,6GAA6G;AAC7G,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED,iFAAiF;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,EAC/B,OAAO,EAAE,CAAC,MAAM,EAAE,uBAAuB,KAAK,IAAI,EAClD,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAChC,cAAc,CAAC,OAAO,CAAC,CAsDzB;AAwDD,iFAAiF;AACjF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,GAC3D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzB"}
@@ -20,7 +20,7 @@ export declare function clearOperationId(data: VercelAiChannelMessage): void;
20
20
  */
21
21
  export declare function clearOperationCallId(callId: string): void;
22
22
  /** The lifecycle event types the `ai:telemetry` channel can carry. */
23
- export type ChannelEventType = 'generateText' | 'streamText' | 'streamObject' | 'generateObject' | 'step' | 'languageModelCall' | 'executeTool' | 'embed' | 'embedMany' | 'rerank' | 'experimental_evaluate' | 'experimental_decide';
23
+ export type ChannelEventType = 'generateText' | 'streamText' | 'streamObject' | 'generateObject' | 'step' | 'languageModelCall' | 'executeTool' | 'embed' | 'embedMany' | 'rerank' | 'experimental_evaluate' | 'experimental_decide' | 'experimental_extract';
24
24
  /**
25
25
  * The context object the AI SDK passes through one tracing-channel call. It is the same object
26
26
  * identity across `start`/`end`/`asyncEnd`/`error`, and Node's `tracingChannel` attaches
@@ -1 +1 @@
1
- {"version":3,"file":"vercel-ai-dc-subscriber.d.ts","sourceRoot":"","sources":["../../../../src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAezD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EAGrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,EAAwC,KAAK,uBAAuB,EAA2B,MAAM,QAAQ,CAAC;AAErH;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,iBAAiB,CAAC;AA0E/D,2GAA2G;AAC3G,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAQnE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAKzD;AA8FD,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,YAAY,GACZ,cAAc,GACd,gBAAgB,GAChB,MAAM,GACN,mBAAmB,GACnB,aAAa,GACb,OAAO,GACP,WAAW,GAC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wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,sBAAsB,GAAG,IAAI,CA6E9E;AAoJD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,sBAAsB,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CA0B/F"}
1
+ {"version":3,"file":"vercel-ai-dc-subscriber.d.ts","sourceRoot":"","sources":["../../../../src/integrations/vercel-ai/vercel-ai-dc-subscriber.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAezD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EAGrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAKL,KAAK,uBAAuB,EAG7B,MAAM,QAAQ,CAAC;AAEhB;;;;GAIG;AACH,eAAO,MAAM,gCAAgC,iBAAiB,CAAC;AA2E/D,2GAA2G;AAC3G,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAQnE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAKzD;AA8FD,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,YAAY,GACZ,cAAc,GACd,gBAAgB,GAChB,MAAM,GACN,mBAAmB,GACnB,aAAa,GACb,OAAO,GACP,WAAW,GACX,QAAQ,GACR,uBAAuB,GACvB,qBAAqB,GACrB,sBAAsB,CAAC;AAE3B;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,gBAAgB,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC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