catchfn 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,773 @@
1
+ // src/collectors/breadcrumbs.ts
2
+ var BreadcrumbCollector = class {
3
+ breadcrumbs = [];
4
+ maxSize;
5
+ constructor(maxSize = 50) {
6
+ this.maxSize = maxSize;
7
+ }
8
+ /**
9
+ * Add a breadcrumb
10
+ */
11
+ add(breadcrumb) {
12
+ const entry = {
13
+ ...breadcrumb,
14
+ timestamp: Date.now()
15
+ };
16
+ this.breadcrumbs.push(entry);
17
+ if (this.breadcrumbs.length > this.maxSize) {
18
+ this.breadcrumbs.shift();
19
+ }
20
+ }
21
+ /**
22
+ * Add a navigation breadcrumb
23
+ */
24
+ addNavigation(from, to) {
25
+ this.add({
26
+ type: "navigation",
27
+ message: `${from} \u2192 ${to}`,
28
+ data: { from, to },
29
+ category: "navigation"
30
+ });
31
+ }
32
+ /**
33
+ * Add a console breadcrumb
34
+ */
35
+ addConsole(level, message) {
36
+ this.add({
37
+ type: "console",
38
+ message,
39
+ level,
40
+ category: "console"
41
+ });
42
+ }
43
+ /**
44
+ * Add a network breadcrumb
45
+ */
46
+ addNetwork(method, url, status) {
47
+ this.add({
48
+ type: "network",
49
+ message: `${method} ${url} ${status ? `(${status})` : ""}`,
50
+ data: { method, url, status },
51
+ category: "network",
52
+ level: status && status >= 400 ? "error" : "info"
53
+ });
54
+ }
55
+ /**
56
+ * Add a user interaction breadcrumb
57
+ */
58
+ addUser(action, target, data) {
59
+ this.add({
60
+ type: "user",
61
+ message: `${action} on ${target}`,
62
+ data: { action, target, ...data },
63
+ category: "user"
64
+ });
65
+ }
66
+ /**
67
+ * Collect all breadcrumbs
68
+ */
69
+ collect() {
70
+ return [...this.breadcrumbs];
71
+ }
72
+ /**
73
+ * Clear all breadcrumbs
74
+ */
75
+ clear() {
76
+ this.breadcrumbs = [];
77
+ }
78
+ /**
79
+ * Get the current number of breadcrumbs
80
+ */
81
+ size() {
82
+ return this.breadcrumbs.length;
83
+ }
84
+ };
85
+
86
+ // src/collectors/console.ts
87
+ var ConsoleCollector = class {
88
+ logs = [];
89
+ maxSize;
90
+ originalMethods = /* @__PURE__ */ new Map();
91
+ isActive = false;
92
+ constructor(maxSize = 100) {
93
+ this.maxSize = maxSize;
94
+ }
95
+ /**
96
+ * Start intercepting console methods
97
+ */
98
+ start() {
99
+ if (this.isActive) return;
100
+ const methods = ["log", "info", "warn", "error", "debug"];
101
+ methods.forEach((method) => {
102
+ this.originalMethods.set(method, console[method].bind(console));
103
+ console[method] = (...args) => {
104
+ this.originalMethods.get(method)?.(...args);
105
+ this.capture(method, args);
106
+ };
107
+ });
108
+ this.isActive = true;
109
+ }
110
+ /**
111
+ * Stop intercepting console methods
112
+ */
113
+ stop() {
114
+ if (!this.isActive) return;
115
+ this.originalMethods.forEach((original, method) => {
116
+ console[method] = original;
117
+ });
118
+ this.originalMethods.clear();
119
+ this.isActive = false;
120
+ }
121
+ /**
122
+ * Capture a console log entry
123
+ */
124
+ capture(level, args) {
125
+ const entry = {
126
+ level,
127
+ args: this.serializeArgs(args),
128
+ timestamp: Date.now()
129
+ };
130
+ this.logs.push(entry);
131
+ if (this.logs.length > this.maxSize) {
132
+ this.logs.shift();
133
+ }
134
+ }
135
+ /**
136
+ * Serialize console arguments
137
+ */
138
+ serializeArgs(args) {
139
+ return args.map((arg) => {
140
+ if (arg === null) return null;
141
+ if (arg === void 0) return void 0;
142
+ if (typeof arg === "string") return arg;
143
+ if (typeof arg === "number") return arg;
144
+ if (typeof arg === "boolean") return arg;
145
+ if (arg instanceof Error) {
146
+ return {
147
+ name: arg.name,
148
+ message: arg.message,
149
+ stack: arg.stack
150
+ };
151
+ }
152
+ try {
153
+ return JSON.parse(JSON.stringify(arg));
154
+ } catch {
155
+ return String(arg);
156
+ }
157
+ });
158
+ }
159
+ /**
160
+ * Collect all console logs
161
+ */
162
+ collect() {
163
+ return [...this.logs];
164
+ }
165
+ /**
166
+ * Clear all console logs
167
+ */
168
+ clear() {
169
+ this.logs = [];
170
+ }
171
+ /**
172
+ * Get the current number of logs
173
+ */
174
+ size() {
175
+ return this.logs.length;
176
+ }
177
+ };
178
+
179
+ // src/collectors/network.ts
180
+ var NetworkCollector = class {
181
+ requests = [];
182
+ maxSize;
183
+ originalFetch;
184
+ originalXHROpen;
185
+ originalXHRSend;
186
+ isActive = false;
187
+ sensitiveHeaders = /* @__PURE__ */ new Set([
188
+ "authorization",
189
+ "cookie",
190
+ "set-cookie",
191
+ "x-api-key",
192
+ "x-auth-token"
193
+ ]);
194
+ constructor(maxSize = 20) {
195
+ this.maxSize = maxSize;
196
+ }
197
+ /**
198
+ * Start intercepting network requests
199
+ */
200
+ start() {
201
+ if (this.isActive) return;
202
+ this.interceptFetch();
203
+ this.interceptXHR();
204
+ this.isActive = true;
205
+ }
206
+ /**
207
+ * Stop intercepting network requests
208
+ */
209
+ stop() {
210
+ if (!this.isActive) return;
211
+ if (this.originalFetch) {
212
+ globalThis.fetch = this.originalFetch;
213
+ }
214
+ if (this.originalXHROpen) {
215
+ XMLHttpRequest.prototype.open = this.originalXHROpen;
216
+ }
217
+ if (this.originalXHRSend) {
218
+ XMLHttpRequest.prototype.send = this.originalXHRSend;
219
+ }
220
+ this.isActive = false;
221
+ }
222
+ /**
223
+ * Intercept fetch API
224
+ */
225
+ interceptFetch() {
226
+ if (typeof fetch === "undefined") return;
227
+ this.originalFetch = fetch;
228
+ globalThis.fetch = async (...args) => {
229
+ const startTime = Date.now();
230
+ const url = typeof args[0] === "string" ? args[0] : args[0] instanceof URL ? args[0].href : args[0].url;
231
+ const method = args[1]?.method || "GET";
232
+ try {
233
+ const response = await this.originalFetch(...args);
234
+ const duration = Date.now() - startTime;
235
+ this.addRequest({
236
+ url,
237
+ method,
238
+ status: response.status,
239
+ statusText: response.statusText,
240
+ duration,
241
+ timestamp: startTime,
242
+ requestHeaders: this.extractHeaders(args[1]?.headers),
243
+ responseHeaders: this.extractHeaders(response.headers)
244
+ });
245
+ return response;
246
+ } catch (error) {
247
+ const duration = Date.now() - startTime;
248
+ this.addRequest({
249
+ url,
250
+ method,
251
+ duration,
252
+ timestamp: startTime,
253
+ requestHeaders: this.extractHeaders(args[1]?.headers)
254
+ });
255
+ throw error;
256
+ }
257
+ };
258
+ }
259
+ /**
260
+ * Intercept XMLHttpRequest
261
+ */
262
+ interceptXHR() {
263
+ if (typeof XMLHttpRequest === "undefined") return;
264
+ this.originalXHROpen = XMLHttpRequest.prototype.open;
265
+ this.originalXHRSend = XMLHttpRequest.prototype.send;
266
+ const collector = this;
267
+ XMLHttpRequest.prototype.open = function(method, url, async, username, password) {
268
+ this.__catchfn_method = method;
269
+ this.__catchfn_url = String(url);
270
+ this.__catchfn_startTime = Date.now();
271
+ return collector.originalXHROpen.call(
272
+ this,
273
+ method,
274
+ url,
275
+ async ?? true,
276
+ username,
277
+ password
278
+ );
279
+ };
280
+ XMLHttpRequest.prototype.send = function(...args) {
281
+ this.addEventListener("loadend", function() {
282
+ const duration = Date.now() - this.__catchfn_startTime;
283
+ collector.addRequest({
284
+ url: this.__catchfn_url,
285
+ method: this.__catchfn_method,
286
+ status: this.status,
287
+ statusText: this.statusText,
288
+ duration,
289
+ timestamp: this.__catchfn_startTime
290
+ });
291
+ });
292
+ return collector.originalXHRSend.call(this, ...args);
293
+ };
294
+ }
295
+ /**
296
+ * Extract and sanitize headers
297
+ */
298
+ extractHeaders(headers) {
299
+ if (!headers) return void 0;
300
+ const result = {};
301
+ if (headers instanceof Headers) {
302
+ headers.forEach((value, key) => {
303
+ if (!this.sensitiveHeaders.has(key.toLowerCase())) {
304
+ result[key] = value;
305
+ } else {
306
+ result[key] = "[REDACTED]";
307
+ }
308
+ });
309
+ } else if (Array.isArray(headers)) {
310
+ headers.forEach(([key, value]) => {
311
+ if (!this.sensitiveHeaders.has(key.toLowerCase())) {
312
+ result[key] = value;
313
+ } else {
314
+ result[key] = "[REDACTED]";
315
+ }
316
+ });
317
+ } else {
318
+ Object.entries(headers).forEach(([key, value]) => {
319
+ if (!this.sensitiveHeaders.has(key.toLowerCase())) {
320
+ result[key] = String(value);
321
+ } else {
322
+ result[key] = "[REDACTED]";
323
+ }
324
+ });
325
+ }
326
+ return result;
327
+ }
328
+ /**
329
+ * Add a network request
330
+ */
331
+ addRequest(request) {
332
+ this.requests.push(request);
333
+ if (this.requests.length > this.maxSize) {
334
+ this.requests.shift();
335
+ }
336
+ }
337
+ /**
338
+ * Collect all network requests
339
+ */
340
+ collect() {
341
+ return [...this.requests];
342
+ }
343
+ /**
344
+ * Clear all network requests
345
+ */
346
+ clear() {
347
+ this.requests = [];
348
+ }
349
+ /**
350
+ * Get the current number of requests
351
+ */
352
+ size() {
353
+ return this.requests.length;
354
+ }
355
+ };
356
+
357
+ // src/collectors/device.ts
358
+ var DeviceCollector = class {
359
+ /**
360
+ * Collect device and environment information
361
+ */
362
+ static collect() {
363
+ const info = {};
364
+ if (typeof navigator !== "undefined") {
365
+ info.userAgent = navigator.userAgent;
366
+ info.platform = navigator.platform;
367
+ info.language = navigator.language;
368
+ if (typeof globalThis !== "undefined" && "screen" in globalThis) {
369
+ const screen = globalThis.screen;
370
+ info.screenResolution = `${screen.width}x${screen.height}`;
371
+ }
372
+ if (typeof globalThis !== "undefined" && "window" in globalThis) {
373
+ const window = globalThis.window;
374
+ info.viewportSize = `${window.innerWidth}x${window.innerHeight}`;
375
+ }
376
+ }
377
+ if (typeof process !== "undefined") {
378
+ info.platform = process.platform;
379
+ info.nodeVersion = process.version;
380
+ if (process.memoryUsage) {
381
+ const mem = process.memoryUsage();
382
+ info.memoryUsage = {
383
+ rss: mem.rss,
384
+ heapTotal: mem.heapTotal,
385
+ heapUsed: mem.heapUsed,
386
+ external: mem.external
387
+ };
388
+ }
389
+ }
390
+ try {
391
+ info.timezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
392
+ } catch {
393
+ }
394
+ return info;
395
+ }
396
+ };
397
+
398
+ // src/utils/redaction.ts
399
+ var SENSITIVE_PATTERNS = [
400
+ /password/i,
401
+ /passwd/i,
402
+ /pwd/i,
403
+ /secret/i,
404
+ /token/i,
405
+ /api[_-]?key/i,
406
+ /access[_-]?key/i,
407
+ /auth/i,
408
+ /credit[_-]?card/i,
409
+ /card[_-]?number/i,
410
+ /cvv/i,
411
+ /ssn/i,
412
+ /social[_-]?security/i
413
+ ];
414
+ var CREDIT_CARD_PATTERN = /\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g;
415
+ function redactObject(obj, customPatterns = []) {
416
+ if (obj === null || obj === void 0) return obj;
417
+ if (typeof obj !== "object") return obj;
418
+ const patterns = [...SENSITIVE_PATTERNS, ...customPatterns];
419
+ if (Array.isArray(obj)) {
420
+ return obj.map((item) => redactObject(item, customPatterns));
421
+ }
422
+ const result = {};
423
+ for (const [key, value] of Object.entries(obj)) {
424
+ const isSensitive = patterns.some((pattern) => pattern.test(key));
425
+ if (isSensitive) {
426
+ result[key] = "[REDACTED]";
427
+ } else if (value && typeof value === "object") {
428
+ result[key] = redactObject(value, customPatterns);
429
+ } else {
430
+ result[key] = value;
431
+ }
432
+ }
433
+ return result;
434
+ }
435
+ function redactString(str) {
436
+ let result = str;
437
+ result = result.replace(CREDIT_CARD_PATTERN, "XXXX-XXXX-XXXX-XXXX");
438
+ return result;
439
+ }
440
+ function redactUrl(url, sensitiveParams = []) {
441
+ try {
442
+ const urlObj = new URL(url);
443
+ const defaultSensitiveParams = [
444
+ "token",
445
+ "key",
446
+ "secret",
447
+ "password",
448
+ "api_key",
449
+ "access_token",
450
+ "auth"
451
+ ];
452
+ const allSensitiveParams = [...defaultSensitiveParams, ...sensitiveParams];
453
+ allSensitiveParams.forEach((param) => {
454
+ if (urlObj.searchParams.has(param)) {
455
+ urlObj.searchParams.set(param, "[REDACTED]");
456
+ }
457
+ });
458
+ return urlObj.toString();
459
+ } catch {
460
+ return url;
461
+ }
462
+ }
463
+ function redactHeaders(headers) {
464
+ const sensitiveHeaders = [
465
+ "authorization",
466
+ "cookie",
467
+ "set-cookie",
468
+ "x-api-key",
469
+ "x-auth-token",
470
+ "x-access-token"
471
+ ];
472
+ const result = {};
473
+ for (const [key, value] of Object.entries(headers)) {
474
+ if (sensitiveHeaders.includes(key.toLowerCase())) {
475
+ result[key] = "[REDACTED]";
476
+ } else {
477
+ result[key] = value;
478
+ }
479
+ }
480
+ return result;
481
+ }
482
+
483
+ // src/utils/serialization.ts
484
+ function serializeError(error) {
485
+ return {
486
+ name: error.name,
487
+ message: error.message,
488
+ stack: error.stack,
489
+ ...Object.getOwnPropertyNames(error).reduce(
490
+ (acc, key) => {
491
+ if (key !== "name" && key !== "message" && key !== "stack") {
492
+ acc[key] = error[key];
493
+ }
494
+ return acc;
495
+ },
496
+ {}
497
+ )
498
+ };
499
+ }
500
+ function safeSerialize(value, maxDepth = 10) {
501
+ const seen = /* @__PURE__ */ new WeakSet();
502
+ function serialize(val, depth) {
503
+ if (depth > maxDepth) {
504
+ return "[Max Depth Reached]";
505
+ }
506
+ if (val === null) return null;
507
+ if (val === void 0) return void 0;
508
+ if (typeof val === "string") return val;
509
+ if (typeof val === "number") return val;
510
+ if (typeof val === "boolean") return val;
511
+ if (typeof val === "function") return "[Function]";
512
+ if (typeof val === "symbol") return val.toString();
513
+ if (val instanceof Error) {
514
+ return serializeError(val);
515
+ }
516
+ if (val instanceof Date) {
517
+ return val.toISOString();
518
+ }
519
+ if (val instanceof RegExp) {
520
+ return val.toString();
521
+ }
522
+ if (typeof val === "object") {
523
+ if (seen.has(val)) {
524
+ return "[Circular Reference]";
525
+ }
526
+ seen.add(val);
527
+ if (Array.isArray(val)) {
528
+ return val.map((item) => serialize(item, depth + 1));
529
+ }
530
+ const result = {};
531
+ for (const key in val) {
532
+ if (Object.prototype.hasOwnProperty.call(val, key)) {
533
+ result[key] = serialize(val[key], depth + 1);
534
+ }
535
+ }
536
+ return result;
537
+ }
538
+ return String(val);
539
+ }
540
+ return serialize(value, 0);
541
+ }
542
+ function estimateSize(obj) {
543
+ try {
544
+ const str = JSON.stringify(safeSerialize(obj));
545
+ return new Blob([str]).size;
546
+ } catch {
547
+ return 0;
548
+ }
549
+ }
550
+ function truncateString(str, maxLength) {
551
+ if (str.length <= maxLength) return str;
552
+ return str.substring(0, maxLength - 3) + "...";
553
+ }
554
+ function trimArray(arr, maxSize) {
555
+ if (arr.length <= maxSize) return arr;
556
+ return arr.slice(-maxSize);
557
+ }
558
+
559
+ // src/utils/size-limiter.ts
560
+ function limitPayloadSize(payload, maxSize) {
561
+ const currentSize = estimateSize(payload);
562
+ if (currentSize <= maxSize) {
563
+ return payload;
564
+ }
565
+ const limited = { ...payload };
566
+ if (Array.isArray(limited.breadcrumbs) && limited.breadcrumbs.length > 10) {
567
+ limited.breadcrumbs = trimArray(limited.breadcrumbs, 10);
568
+ }
569
+ if (Array.isArray(limited.consoleLogs) && limited.consoleLogs.length > 20) {
570
+ limited.consoleLogs = trimArray(limited.consoleLogs, 20);
571
+ }
572
+ if (Array.isArray(limited.networkRequests) && limited.networkRequests.length > 5) {
573
+ limited.networkRequests = trimArray(limited.networkRequests, 5);
574
+ }
575
+ if (typeof limited.description === "string" && limited.description.length > 1e3) {
576
+ limited.description = truncateString(limited.description, 1e3);
577
+ }
578
+ const newSize = estimateSize(limited);
579
+ if (newSize <= maxSize) {
580
+ return limited;
581
+ }
582
+ delete limited.consoleLogs;
583
+ delete limited.networkRequests;
584
+ return limited;
585
+ }
586
+
587
+ // src/core/catch-fn.ts
588
+ function generateId() {
589
+ return `bug_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;
590
+ }
591
+ var CatchFn = class {
592
+ config;
593
+ breadcrumbCollector;
594
+ consoleCollector;
595
+ networkCollector;
596
+ beforeSendHooks = [];
597
+ ignorePatterns = [];
598
+ constructor(config) {
599
+ this.config = {
600
+ ...config,
601
+ maxBreadcrumbs: config.maxBreadcrumbs ?? 50,
602
+ maxConsoleLogs: config.maxConsoleLogs ?? 100,
603
+ maxNetworkRequests: config.maxNetworkRequests ?? 20,
604
+ defaultSeverity: config.defaultSeverity ?? "medium",
605
+ ignorePatterns: config.ignorePatterns ?? [],
606
+ maxPayloadSize: config.maxPayloadSize ?? 262144,
607
+ // 256KB
608
+ sensitiveFields: config.sensitiveFields ?? [],
609
+ enableBreadcrumbs: config.enableBreadcrumbs ?? true,
610
+ enableConsoleCapture: config.enableConsoleCapture ?? false,
611
+ enableNetworkCapture: config.enableNetworkCapture ?? false
612
+ };
613
+ this.breadcrumbCollector = new BreadcrumbCollector(
614
+ this.config.maxBreadcrumbs
615
+ );
616
+ if (this.config.enableConsoleCapture) {
617
+ this.consoleCollector = new ConsoleCollector(this.config.maxConsoleLogs);
618
+ this.consoleCollector.start();
619
+ }
620
+ if (this.config.enableNetworkCapture) {
621
+ this.networkCollector = new NetworkCollector(
622
+ this.config.maxNetworkRequests
623
+ );
624
+ this.networkCollector.start();
625
+ }
626
+ if (this.config.beforeSend) {
627
+ this.beforeSendHooks.push(this.config.beforeSend);
628
+ }
629
+ this.ignorePatterns = [...this.config.ignorePatterns];
630
+ }
631
+ /**
632
+ * Add a breadcrumb
633
+ */
634
+ addBreadcrumb(breadcrumb) {
635
+ if (!this.config.enableBreadcrumbs) return;
636
+ this.breadcrumbCollector.add(breadcrumb);
637
+ }
638
+ /**
639
+ * Register a beforeSend hook
640
+ */
641
+ beforeSend(hook) {
642
+ this.beforeSendHooks.push(hook);
643
+ }
644
+ /**
645
+ * Add an ignore pattern
646
+ */
647
+ addIgnorePattern(pattern) {
648
+ this.ignorePatterns.push(pattern);
649
+ }
650
+ /**
651
+ * Check if an event should be ignored
652
+ */
653
+ shouldIgnore(event) {
654
+ const message = event.title + " " + (event.description || "");
655
+ return this.ignorePatterns.some((pattern) => {
656
+ if (typeof pattern === "string") {
657
+ return message.includes(pattern);
658
+ }
659
+ return pattern.test(message);
660
+ });
661
+ }
662
+ /**
663
+ * Apply beforeSend hooks
664
+ */
665
+ async applyHooks(event) {
666
+ let current = event;
667
+ for (const hook of this.beforeSendHooks) {
668
+ if (!current) break;
669
+ try {
670
+ current = await hook(current);
671
+ } catch (error) {
672
+ console.error("CatchFn: beforeSend hook failed:", error);
673
+ }
674
+ }
675
+ return current;
676
+ }
677
+ /**
678
+ * Capture a bug report
679
+ */
680
+ async captureBug(options) {
681
+ let event = {
682
+ id: generateId(),
683
+ timestamp: Date.now(),
684
+ title: options.title,
685
+ description: options.description,
686
+ severity: options.severity || this.config.defaultSeverity,
687
+ tags: options.tags,
688
+ environment: options.environment || this.config.environment,
689
+ release: options.release || this.config.release,
690
+ user: options.user || this.config.user,
691
+ metadata: options.metadata,
692
+ attachments: options.attachments
693
+ };
694
+ if (this.config.enableBreadcrumbs) {
695
+ event.breadcrumbs = this.breadcrumbCollector.collect();
696
+ }
697
+ if (this.consoleCollector) {
698
+ event.consoleLogs = this.consoleCollector.collect();
699
+ }
700
+ if (this.networkCollector) {
701
+ event.networkRequests = this.networkCollector.collect();
702
+ }
703
+ event.deviceInfo = DeviceCollector.collect();
704
+ event = redactObject(
705
+ event,
706
+ this.config.sensitiveFields.map((f) => new RegExp(f, "i"))
707
+ );
708
+ event = safeSerialize(event);
709
+ event = limitPayloadSize(event, this.config.maxPayloadSize);
710
+ if (this.shouldIgnore(event)) {
711
+ console.log("CatchFn: Event ignored by ignore patterns");
712
+ return event;
713
+ }
714
+ const processedEvent = await this.applyHooks(event);
715
+ if (!processedEvent) {
716
+ console.log("CatchFn: Event dropped by beforeSend hook");
717
+ return event;
718
+ }
719
+ console.log("CatchFn: Bug captured", {
720
+ id: processedEvent.id,
721
+ title: processedEvent.title,
722
+ severity: processedEvent.severity
723
+ });
724
+ return processedEvent;
725
+ }
726
+ /**
727
+ * Clear all collected context
728
+ */
729
+ clear() {
730
+ this.breadcrumbCollector.clear();
731
+ this.consoleCollector?.clear();
732
+ this.networkCollector?.clear();
733
+ }
734
+ /**
735
+ * Stop all collectors
736
+ */
737
+ stop() {
738
+ this.consoleCollector?.stop();
739
+ this.networkCollector?.stop();
740
+ }
741
+ /**
742
+ * Get current configuration
743
+ */
744
+ getConfig() {
745
+ return { ...this.config };
746
+ }
747
+ };
748
+
749
+ // src/index.ts
750
+ function catchFn(config) {
751
+ return new CatchFn(config);
752
+ }
753
+ var index_default = catchFn;
754
+ export {
755
+ BreadcrumbCollector,
756
+ CatchFn,
757
+ ConsoleCollector,
758
+ DeviceCollector,
759
+ NetworkCollector,
760
+ catchFn,
761
+ index_default as default,
762
+ estimateSize,
763
+ limitPayloadSize,
764
+ redactHeaders,
765
+ redactObject,
766
+ redactString,
767
+ redactUrl,
768
+ safeSerialize,
769
+ serializeError,
770
+ trimArray,
771
+ truncateString
772
+ };
773
+ //# sourceMappingURL=index.js.map