@bugspotter/sdk 1.0.0 → 1.1.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.
- package/dist/bugspotter.min.js +1 -1
- package/dist/bugspotter.min.js.map +1 -1
- package/dist/capture/console.js +2 -2
- package/dist/capture/network.js +2 -2
- package/dist/index.esm.js +210 -313
- package/dist/index.esm.js.map +1 -1
- package/dist/utils/sanitize-patterns.d.ts +3 -76
- package/dist/utils/sanitize-patterns.js +18 -216
- package/dist/utils/url-helpers.d.ts +2 -40
- package/dist/utils/url-helpers.js +10 -97
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -1
- package/release_notes.md +1 -16
- package/rollup.config.js +1 -1
- package/dist/core/circular-buffer.d.ts +0 -42
- package/dist/core/circular-buffer.js +0 -80
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CircularBuffer = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* A generic circular buffer implementation for storing a fixed number of items.
|
|
6
|
-
* When the buffer is full, new items overwrite the oldest items.
|
|
7
|
-
*
|
|
8
|
-
* @template T The type of items stored in the buffer
|
|
9
|
-
*/
|
|
10
|
-
class CircularBuffer {
|
|
11
|
-
constructor(maxSize) {
|
|
12
|
-
this.maxSize = maxSize;
|
|
13
|
-
this.items = [];
|
|
14
|
-
this.index = 0;
|
|
15
|
-
this.count = 0;
|
|
16
|
-
if (maxSize <= 0) {
|
|
17
|
-
throw new Error('CircularBuffer maxSize must be greater than 0');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Add an item to the buffer. If the buffer is full, the oldest item is overwritten.
|
|
22
|
-
*/
|
|
23
|
-
add(item) {
|
|
24
|
-
if (this.count < this.maxSize) {
|
|
25
|
-
this.items.push(item);
|
|
26
|
-
this.count++;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
this.items[this.index] = item;
|
|
30
|
-
}
|
|
31
|
-
this.index = (this.index + 1) % this.maxSize;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Get all items in chronological order (oldest to newest).
|
|
35
|
-
* Returns a copy of the internal array.
|
|
36
|
-
*/
|
|
37
|
-
getAll() {
|
|
38
|
-
if (this.count < this.maxSize) {
|
|
39
|
-
return [...this.items];
|
|
40
|
-
}
|
|
41
|
-
// Return items in chronological order when buffer is full
|
|
42
|
-
return [
|
|
43
|
-
...this.items.slice(this.index),
|
|
44
|
-
...this.items.slice(0, this.index),
|
|
45
|
-
];
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Clear all items from the buffer.
|
|
49
|
-
*/
|
|
50
|
-
clear() {
|
|
51
|
-
this.items = [];
|
|
52
|
-
this.index = 0;
|
|
53
|
-
this.count = 0;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Get the current number of items in the buffer.
|
|
57
|
-
*/
|
|
58
|
-
get size() {
|
|
59
|
-
return this.count;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Get the maximum capacity of the buffer.
|
|
63
|
-
*/
|
|
64
|
-
get capacity() {
|
|
65
|
-
return this.maxSize;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Check if the buffer is empty.
|
|
69
|
-
*/
|
|
70
|
-
get isEmpty() {
|
|
71
|
-
return this.count === 0;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Check if the buffer is full.
|
|
75
|
-
*/
|
|
76
|
-
get isFull() {
|
|
77
|
-
return this.count >= this.maxSize;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
exports.CircularBuffer = CircularBuffer;
|