@@ -11,11 +11,6 @@ import log from '../utils/log';
1111 */
1212const DEFAULT_MAX_BREADCRUMBS = 15 ;
1313
14- /**
15- * Maximum length for string values in breadcrumb data
16- */
17- const DEFAULT_MAX_VALUE_LENGTH = 1024 ;
18-
1914/**
2015 * Hint object passed to beforeBreadcrumb callback
2116 */
@@ -52,13 +47,6 @@ export interface BreadcrumbsOptions {
5247 */
5348 maxBreadcrumbs ?: number ;
5449
55- /**
56- * Maximum length for string values (will be trimmed)
57- *
58- * @default 1024
59- */
60- maxValueLength ?: number ;
61-
6250 /**
6351 * Hook called before each breadcrumb is stored
6452 * Return null to discard the breadcrumb
@@ -100,7 +88,6 @@ export type BreadcrumbInput = Omit<Breadcrumb, 'timestamp'> & { timestamp?: Brea
10088 */
10189interface InternalBreadcrumbsOptions {
10290 maxBreadcrumbs : number ;
103- maxValueLength : number ;
10491 trackFetch : boolean ;
10592 trackNavigation : boolean ;
10693 trackClicks : boolean ;
@@ -172,7 +159,6 @@ export class BreadcrumbManager {
172159 private constructor ( ) {
173160 this . options = {
174161 maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS ,
175- maxValueLength : DEFAULT_MAX_VALUE_LENGTH ,
176162 trackFetch : true ,
177163 trackNavigation : true ,
178164 trackClicks : true ,
@@ -202,7 +188,6 @@ export class BreadcrumbManager {
202188
203189 this . options = {
204190 maxBreadcrumbs : options . maxBreadcrumbs ?? DEFAULT_MAX_BREADCRUMBS ,
205- maxValueLength : options . maxValueLength ?? DEFAULT_MAX_VALUE_LENGTH ,
206191 beforeBreadcrumb : options . beforeBreadcrumb ,
207192 trackFetch : options . trackFetch ?? true ,
208193 trackNavigation : options . trackNavigation ?? true ,
@@ -261,18 +246,18 @@ export class BreadcrumbManager {
261246 }
262247
263248 /**
264- * Sanitize and trim data
249+ * Sanitize data and message
265250 */
266251 if ( bc . data ) {
267- bc . data = this . sanitizeData ( bc . data ) ;
252+ bc . data = Sanitizer . sanitize ( bc . data ) as Record < string , JsonNode > ;
268253 }
269254
270255 if ( bc . message ) {
271- bc . message = this . trimString ( bc . message , this . options . maxValueLength ) ;
256+ bc . message = Sanitizer . sanitize ( bc . message ) as string ;
272257 }
273258
274259 /**
275- * Add to buffer (FIFO - keep last N breadcrumbs )
260+ * Add to buffer (FIFO)
276261 */
277262 this . breadcrumbs . push ( bc ) ;
278263
@@ -354,29 +339,6 @@ export class BreadcrumbManager {
354339 BreadcrumbManager . instance = null ;
355340 }
356341
357- /**
358- * Sanitize breadcrumb data object
359- * Sanitizer already trims strings, so no additional trimming needed
360- *
361- * @param data - The data object to sanitize
362- */
363- private sanitizeData ( data : Record < string , unknown > ) : Record < string , JsonNode > {
364- return Sanitizer . sanitize ( data ) as Record < string , JsonNode > ;
365- }
366-
367- /**
368- * Trim string to max length
369- *
370- * @param str - The string to trim
371- * @param maxLength - Maximum allowed length
372- */
373- private trimString ( str : string , maxLength : number ) : string {
374- if ( str . length > maxLength ) {
375- return str . substring ( 0 , maxLength ) + '…' ;
376- }
377-
378- return str ;
379- }
380342
381343 /**
382344 * Monkeypatch fetch API to capture HTTP breadcrumbs
0 commit comments