fixparser-plugin-messagestore-kdb 9.4.13-b135e2c2 → 9.5.0-158b22ee

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 CHANGED
@@ -3577,4 +3577,3 @@ The Licensor shall promptly notify the Licensee Developers of all revisions, add
3577
3577
  </tbody>
3578
3578
 
3579
3579
  </table>
3580
-
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  `fixparser-plugin-messagestore-kdb` is a FIXParser plugin designed for managing a message buffer in a KDB+ instance. It stores and retrieves FIX messages over a WebSocket connection to KDB+, providing an asynchronous interface for interacting with the data.
4
4
 
5
5
  ## Features
6
+
6
7
  - **WebSocket Connection**: Connects to a KDB+ instance via WebSocket to send and receive messages.
7
8
  - **Message Buffering**: Stores messages in a configurable buffer, with an option to limit the buffer size.
8
9
  - **FIX Message Parsing**: Uses a provided FIX parser to serialize/deserialize FIX messages.
@@ -24,7 +25,6 @@ chmod +x ./kdb.sh
24
25
  ./kdb.sh
25
26
  ```
26
27
 
27
-
28
28
  ## Usage
29
29
 
30
30
  ### Creating a `MessageStoreKDB` Instance
@@ -41,7 +41,7 @@ const store = new MessageStoreKDB({
41
41
  logger: fixParser.logger,
42
42
  onReady: () => {
43
43
  console.log('Connection to KDB+ established and ready.');
44
- }
44
+ },
45
45
  });
46
46
 
47
47
  fixParser.connect({
@@ -57,7 +57,6 @@ fixParser.connect({
57
57
  onMessage: (message: Message) => console.log('received message', message.description, message.messageString),
58
58
  onClose: () => console.log('Disconnected'),
59
59
  });
60
-
61
60
  ```
62
61
 
63
62
  ### Adding a Message to the Buffer
@@ -71,37 +70,33 @@ const message = new Message(
71
70
  new Field(Fields.MsgSeqNum, fixParser.getNextTargetMsgSeqNum()),
72
71
  new Field(Fields.ExecTransType, ExecTransType.New),
73
72
  );
74
- store.add(message)
75
- .then(() => console.log('Message added to the buffer.'));
73
+ store.add(message).then(() => console.log('Message added to the buffer.'));
76
74
  ```
77
75
 
78
76
  ### Retrieving a Message by Sequence Number
79
77
 
80
78
  ```typescript
81
- store.getByMsgSequence(1)
82
- .then((message) => {
83
- if (message) {
84
- console.log('Retrieved message:', message);
85
- } else {
86
- console.log('Message not found.');
87
- }
88
- });
79
+ store.getByMsgSequence(1).then((message) => {
80
+ if (message) {
81
+ console.log('Retrieved message:', message);
82
+ } else {
83
+ console.log('Message not found.');
84
+ }
85
+ });
89
86
  ```
90
87
 
91
88
  ### Getting the Buffer Size
92
89
 
93
90
  ```typescript
94
- store.size()
95
- .then((size) => {
96
- console.log('Current buffer size:', size);
97
- });
91
+ store.size().then((size) => {
92
+ console.log('Current buffer size:', size);
93
+ });
98
94
  ```
99
95
 
100
96
  ### Clearing the Buffer
101
97
 
102
98
  ```typescript
103
- store.clear()
104
- .then(() => console.log('Buffer cleared.'));
99
+ store.clear().then(() => console.log('Buffer cleared.'));
105
100
  ```
106
101
 
107
102
  ## Configuration Options
@@ -115,4 +110,5 @@ store.clear()
115
110
  - `onReady` (function): A callback function that is called when the KDB+ connection is ready.
116
111
 
117
112
  ## License
118
- This project is licensed under a Commercial License - see the [LICENSE](https://gitlab.com/logotype/fixparser/-/blob/dev/LICENSE.md) file for details.
113
+
114
+ This project is licensed under a Commercial License - see the [LICENSE](https://gitlab.com/logotype/fixparser/-/blob/dev/LICENSE.md) file for details.
@@ -61,6 +61,7 @@ var require_constants = __commonJS({
61
61
  var require_buffer_util = __commonJS({
62
62
  "../../node_modules/ws/lib/buffer-util.js"(exports2, module2) {
63
63
  "use strict";
64
+ var { websocketMask, websocketUnmask } = require("http");
64
65
  var { EMPTY_BUFFER } = require_constants();
65
66
  var FastBuffer = Buffer[Symbol.species];
66
67
  function concat(list, totalLength) {
@@ -115,7 +116,16 @@ var require_buffer_util = __commonJS({
115
116
  toBuffer,
116
117
  unmask: _unmask
117
118
  };
118
- if (!process.env.WS_NO_BUFFER_UTIL) {
119
+ if (websocketMask) {
120
+ module2.exports.mask = function(source, mask, output, offset, length) {
121
+ if (length < 24) _mask(source, mask, output, offset, length);
122
+ else websocketMask(source, mask, output, offset, length);
123
+ };
124
+ module2.exports.unmask = function(buffer, mask) {
125
+ if (buffer.length < 24) _unmask(buffer, mask);
126
+ else websocketUnmask(buffer, mask);
127
+ };
128
+ } else if (!process.env.WS_NO_BUFFER_UTIL) {
119
129
  try {
120
130
  const bufferUtil = require("bufferutil");
121
131
  module2.exports.mask = function(source, mask, output, offset, length) {
@@ -1510,12 +1520,15 @@ var require_sender = __commonJS({
1510
1520
  target[2] = target[3] = 0;
1511
1521
  target.writeUIntBE(dataLength, 4, 6);
1512
1522
  }
1513
- if (!options.mask) return [target, data];
1523
+ if (!options.mask) {
1524
+ return dataLength ? [target, data] : [target];
1525
+ }
1514
1526
  target[1] |= 128;
1515
1527
  target[offset - 4] = mask[0];
1516
1528
  target[offset - 3] = mask[1];
1517
1529
  target[offset - 2] = mask[2];
1518
1530
  target[offset - 1] = mask[3];
1531
+ if (!dataLength) return [target];
1519
1532
  if (skipMasking) return [target, data];
1520
1533
  if (merge) {
1521
1534
  applyMask(data, mask, target, offset, dataLength);
@@ -2873,9 +2886,14 @@ var require_websocket = __commonJS({
2873
2886
  opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
2874
2887
  }
2875
2888
  if (isIpcUrl) {
2876
- const parts = opts.path.split(":");
2877
- opts.socketPath = parts[0];
2878
- opts.path = parts[1];
2889
+ const i = opts.path.indexOf(":");
2890
+ if (i === -1) {
2891
+ opts.socketPath = opts.path;
2892
+ opts.path = "";
2893
+ } else {
2894
+ opts.socketPath = opts.path.slice(0, i);
2895
+ opts.path = opts.path.slice(i + 1);
2896
+ }
2879
2897
  }
2880
2898
  let req;
2881
2899
  if (opts.followRedirects) {