fixparser-common 9.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/LICENSE.md +3656 -0
- package/build/cjs/index.js +203 -0
- package/build/cjs/index.js.map +7 -0
- package/build/esm/index.mjs +175 -0
- package/build/esm/index.mjs.map +7 -0
- package/package.json +30 -0
- package/types/ILogTransporter.d.ts +35 -0
- package/types/IMessage.d.ts +4 -0
- package/types/IMessageStore.d.ts +95 -0
- package/types/Level.d.ts +11 -0
- package/types/LogMessage.d.ts +7 -0
- package/types/MessageBuffer.d.ts +104 -0
- package/types/index.d.ts +7 -0
- package/types/uuidv4.d.ts +1 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import type { IMessageStore } from './IMessageStore';
|
|
2
|
+
/**
|
|
3
|
+
* A buffer that stores items of type `T` up to a specified maximum size.
|
|
4
|
+
* Implements the IMessageStore interface for generic types.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MessageBuffer<T> implements IMessageStore<T> {
|
|
7
|
+
/**
|
|
8
|
+
* A number representing the next expected message sequence number.
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
private nextMsgSeqNum;
|
|
12
|
+
/**
|
|
13
|
+
* An array holding the items in the buffer.
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
private buffer;
|
|
17
|
+
/**
|
|
18
|
+
* The maximum capacity of the buffer.
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
private maxBufferSize;
|
|
22
|
+
constructor(maxBufferSize?: number);
|
|
23
|
+
/**
|
|
24
|
+
* Adds a new item to the buffer.
|
|
25
|
+
* If the buffer is full, the oldest item is removed to make space for the new one.
|
|
26
|
+
*
|
|
27
|
+
* @param {T} item - The item to add to the buffer.
|
|
28
|
+
* @returns {void}
|
|
29
|
+
*/
|
|
30
|
+
add(item: T): void;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves an item from the buffer by its sequence number (or any other identifier).
|
|
33
|
+
*
|
|
34
|
+
* @param {number} msgSequence - The sequence number of the item to retrieve.
|
|
35
|
+
* @returns {T | undefined} The item if found, or `undefined` if not found.
|
|
36
|
+
*/
|
|
37
|
+
getByMsgSequence(msgSequence: number): T | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Removes an item from the buffer by its sequence number.
|
|
40
|
+
*
|
|
41
|
+
* @param {number} msgSequence - The sequence number of the item to remove.
|
|
42
|
+
* @returns {void}
|
|
43
|
+
*/
|
|
44
|
+
remove(msgSequence: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Updates an item in the buffer.
|
|
47
|
+
*
|
|
48
|
+
* @param {number} msgSequence - The sequence number of the item to update.
|
|
49
|
+
* @param {T} item - The updated item.
|
|
50
|
+
* @returns {boolean} - Returns `true` if the item was updated successfully, `false` otherwise.
|
|
51
|
+
*/
|
|
52
|
+
update(msgSequence: number, item: T): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves all items from the buffer.
|
|
55
|
+
*
|
|
56
|
+
* @returns {T[]} - An array of all items in the buffer.
|
|
57
|
+
*/
|
|
58
|
+
getAll(): T[];
|
|
59
|
+
/**
|
|
60
|
+
* Checks if an item with a given sequence number exists in the buffer.
|
|
61
|
+
*
|
|
62
|
+
* @param {number} msgSequence - The sequence number of the item to check.
|
|
63
|
+
* @returns {boolean} - `true` if the item exists, `false` otherwise.
|
|
64
|
+
*/
|
|
65
|
+
exists(msgSequence: number): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Gets the current size of the buffer (the number of items it contains).
|
|
68
|
+
*
|
|
69
|
+
* @returns {number} The number of items currently in the buffer.
|
|
70
|
+
*/
|
|
71
|
+
size(): number;
|
|
72
|
+
/**
|
|
73
|
+
* Resizes the buffer's capacity.
|
|
74
|
+
*
|
|
75
|
+
* @param {number} newCapacity - The new maximum capacity for the buffer.
|
|
76
|
+
* @returns {void}
|
|
77
|
+
*/
|
|
78
|
+
resize(newCapacity: number): void;
|
|
79
|
+
/**
|
|
80
|
+
* Clears all items from the buffer.
|
|
81
|
+
*
|
|
82
|
+
* @returns {void}
|
|
83
|
+
*/
|
|
84
|
+
clear(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the maximum capacity of the buffer.
|
|
87
|
+
*
|
|
88
|
+
* @returns {number} The maximum number of items the buffer can hold.
|
|
89
|
+
*/
|
|
90
|
+
getCapacity(): number;
|
|
91
|
+
/**
|
|
92
|
+
* Set the next message sequence number.
|
|
93
|
+
*
|
|
94
|
+
* @param nextMsgSeqNum - The next message sequence number.
|
|
95
|
+
* @returns {number} - The next message sequence number.
|
|
96
|
+
*/
|
|
97
|
+
setNextMsgSeqNum(nextMsgSeqNum: number): number;
|
|
98
|
+
/**
|
|
99
|
+
* Get the next message sequence number.
|
|
100
|
+
*
|
|
101
|
+
* @returns {number} - The next message sequence number.
|
|
102
|
+
*/
|
|
103
|
+
getNextMsgSeqNum(): number;
|
|
104
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ILogTransporter } from './ILogTransporter';
|
|
2
|
+
export { Level } from './Level';
|
|
3
|
+
export { LogMessage } from './LogMessage';
|
|
4
|
+
export { MessageBuffer } from './MessageBuffer';
|
|
5
|
+
export type { IMessageStore } from './IMessageStore';
|
|
6
|
+
export type { IMessage } from './IMessage';
|
|
7
|
+
export { uuidv4 } from './uuidv4';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const uuidv4: () => string;
|