@openfeed/sdk-js 1.3.3 → 1.4.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/.releases/CHANGELOG-1.4.0.md +10 -0
- package/.releases/CHANGELOG-1.4.1.md +15 -0
- package/CHANGELOG.md +2 -2
- package/README.md +11 -0
- package/dist/generated/openfeed_instrument.d.ts +17 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.js +277 -228
- package/dist/node.js +86 -5
- package/dist/src/connection/listeners.d.ts +2 -0
- package/package.json +2 -2
- /package/dist/{empty-411f875a.js → empty-BvAKRCY4.js} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
### [1.3.3](https://github.com/openfeed-org/sdk-js/compare/1.3.2...1.3.3) (2025-03-28)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* take a better approach when identifying subscription responses - use correlation ([d841c79](https://github.com/openfeed-org/sdk-js/commit/d841c7996c068b10675e20832c413c4da466996a))
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
## [1.4.0](https://github.com/openfeed-org/sdk-js/compare/1.3.3...1.4.0) (2025-06-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* regenarate files from proto ([14f3cad](https://github.com/openfeed-org/sdk-js/commit/14f3cad8a50cc31281ab21f9b701a1d997c4b65a))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* extend error logging ([2c31557](https://github.com/openfeed-org/sdk-js/commit/2c315576f871abcaef985ae4a81c7f98b969e692))
|
package/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
### [1.
|
|
5
|
+
### [1.4.1](https://github.com/openfeed-org/sdk-js/compare/1.4.0...1.4.1) (2025-12-22)
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
### Bug Fixes
|
|
9
9
|
|
|
10
|
-
*
|
|
10
|
+
* add clean up of state on disconnect ([9cf3452](https://github.com/openfeed-org/sdk-js/commit/9cf345218d3f6386e3a9189bc543ab5236e0c958))
|
package/README.md
CHANGED
|
@@ -24,6 +24,17 @@ The User Guide for this project can be found in the [documentation](DOCUMENTATIO
|
|
|
24
24
|
|
|
25
25
|
This library uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for clarity, tracking changes and versioning. It's recommended to install [Conventional Commits Extension for VS Code](https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits) when contributing to the library.
|
|
26
26
|
|
|
27
|
+
### Updating proto
|
|
28
|
+
|
|
29
|
+
To update the proto files, run:
|
|
30
|
+
|
|
31
|
+
```shell
|
|
32
|
+
yarn add git+ssh://git@github.com/openfeed-org/proto.git#master -D
|
|
33
|
+
yarn generate
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then commit the changes.
|
|
37
|
+
|
|
27
38
|
### Preparing a new version
|
|
28
39
|
|
|
29
40
|
For updating the version and automatically collecting changes, run:
|
|
@@ -148,6 +148,11 @@ export interface InstrumentDefinition {
|
|
|
148
148
|
priceScalingExponent: number;
|
|
149
149
|
/** / The Openfeed marketId of the underlying asset. */
|
|
150
150
|
underlyingOpenfeedMarketId: Long;
|
|
151
|
+
/** / Barchart Exchange Name */
|
|
152
|
+
barchartExchange: string;
|
|
153
|
+
contractSize: Long;
|
|
154
|
+
contractSizeDescription: string;
|
|
155
|
+
exchangeMetadata: InstrumentDefinition_ExchangeMetadata | undefined;
|
|
151
156
|
}
|
|
152
157
|
/** ############################################# */
|
|
153
158
|
export declare enum InstrumentDefinition_InstrumentType {
|
|
@@ -292,6 +297,13 @@ export interface InstrumentDefinition_CurrencyPair {
|
|
|
292
297
|
currency1: string;
|
|
293
298
|
currency2: string;
|
|
294
299
|
}
|
|
300
|
+
/** / Exchange Metadata */
|
|
301
|
+
export interface InstrumentDefinition_ExchangeMetadata {
|
|
302
|
+
securityId: Long;
|
|
303
|
+
channelId: string;
|
|
304
|
+
sbeId: number;
|
|
305
|
+
underlyingSecurityId: Long;
|
|
306
|
+
}
|
|
295
307
|
export declare const InstrumentDefinitionEncode: {
|
|
296
308
|
encode(message: InstrumentDefinition, writer?: _m0.Writer): _m0.Writer;
|
|
297
309
|
}, InstrumentDefinitionDecode: {
|
|
@@ -342,3 +354,8 @@ export declare const InstrumentDefinition_CurrencyPairEncode: {
|
|
|
342
354
|
}, InstrumentDefinition_CurrencyPairDecode: {
|
|
343
355
|
decode(input: _m0.Reader | Uint8Array, length?: number): InstrumentDefinition_CurrencyPair;
|
|
344
356
|
};
|
|
357
|
+
export declare const InstrumentDefinition_ExchangeMetadataEncode: {
|
|
358
|
+
encode(message: InstrumentDefinition_ExchangeMetadata, writer?: _m0.Writer): _m0.Writer;
|
|
359
|
+
}, InstrumentDefinition_ExchangeMetadataDecode: {
|
|
360
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): InstrumentDefinition_ExchangeMetadata;
|
|
361
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.4.1";
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
return value;
|
|
6
|
-
};
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
4
|
var ws = null;
|
|
8
5
|
if (typeof WebSocket !== "undefined") {
|
|
9
6
|
ws = WebSocket;
|
|
@@ -831,26 +828,19 @@ LongPrototype.shiftRight = function shiftRight(numBits) {
|
|
|
831
828
|
};
|
|
832
829
|
LongPrototype.shr = LongPrototype.shiftRight;
|
|
833
830
|
LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
|
|
834
|
-
if (isLong(numBits))
|
|
835
|
-
|
|
836
|
-
if (
|
|
837
|
-
|
|
838
|
-
if (numBits < 32)
|
|
839
|
-
return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
|
|
840
|
-
if (numBits === 32)
|
|
841
|
-
return fromBits(this.high, 0, this.unsigned);
|
|
831
|
+
if (isLong(numBits)) numBits = numBits.toInt();
|
|
832
|
+
if ((numBits &= 63) === 0) return this;
|
|
833
|
+
if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
|
|
834
|
+
if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
|
|
842
835
|
return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
|
|
843
836
|
};
|
|
844
837
|
LongPrototype.shru = LongPrototype.shiftRightUnsigned;
|
|
845
838
|
LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
|
|
846
839
|
LongPrototype.rotateLeft = function rotateLeft(numBits) {
|
|
847
840
|
var b;
|
|
848
|
-
if (isLong(numBits))
|
|
849
|
-
|
|
850
|
-
if (
|
|
851
|
-
return this;
|
|
852
|
-
if (numBits === 32)
|
|
853
|
-
return fromBits(this.high, this.low, this.unsigned);
|
|
841
|
+
if (isLong(numBits)) numBits = numBits.toInt();
|
|
842
|
+
if ((numBits &= 63) === 0) return this;
|
|
843
|
+
if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
|
|
854
844
|
if (numBits < 32) {
|
|
855
845
|
b = 32 - numBits;
|
|
856
846
|
return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned);
|
|
@@ -862,12 +852,9 @@ LongPrototype.rotateLeft = function rotateLeft(numBits) {
|
|
|
862
852
|
LongPrototype.rotl = LongPrototype.rotateLeft;
|
|
863
853
|
LongPrototype.rotateRight = function rotateRight(numBits) {
|
|
864
854
|
var b;
|
|
865
|
-
if (isLong(numBits))
|
|
866
|
-
|
|
867
|
-
if (
|
|
868
|
-
return this;
|
|
869
|
-
if (numBits === 32)
|
|
870
|
-
return fromBits(this.high, this.low, this.unsigned);
|
|
855
|
+
if (isLong(numBits)) numBits = numBits.toInt();
|
|
856
|
+
if ((numBits &= 63) === 0) return this;
|
|
857
|
+
if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
|
|
871
858
|
if (numBits < 32) {
|
|
872
859
|
b = 32 - numBits;
|
|
873
860
|
return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned);
|
|
@@ -1104,175 +1091,171 @@ EventEmitter.prototype.emit = function emit(evt) {
|
|
|
1104
1091
|
};
|
|
1105
1092
|
var float = factory(factory);
|
|
1106
1093
|
function factory(exports) {
|
|
1107
|
-
if (typeof Float32Array !== "undefined")
|
|
1108
|
-
(
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1094
|
+
if (typeof Float32Array !== "undefined") (function() {
|
|
1095
|
+
var f32 = new Float32Array([-0]), f8b = new Uint8Array(f32.buffer), le = f8b[3] === 128;
|
|
1096
|
+
function writeFloat_f32_cpy(val, buf, pos) {
|
|
1097
|
+
f32[0] = val;
|
|
1098
|
+
buf[pos] = f8b[0];
|
|
1099
|
+
buf[pos + 1] = f8b[1];
|
|
1100
|
+
buf[pos + 2] = f8b[2];
|
|
1101
|
+
buf[pos + 3] = f8b[3];
|
|
1102
|
+
}
|
|
1103
|
+
function writeFloat_f32_rev(val, buf, pos) {
|
|
1104
|
+
f32[0] = val;
|
|
1105
|
+
buf[pos] = f8b[3];
|
|
1106
|
+
buf[pos + 1] = f8b[2];
|
|
1107
|
+
buf[pos + 2] = f8b[1];
|
|
1108
|
+
buf[pos + 3] = f8b[0];
|
|
1109
|
+
}
|
|
1110
|
+
exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;
|
|
1111
|
+
exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;
|
|
1112
|
+
function readFloat_f32_cpy(buf, pos) {
|
|
1113
|
+
f8b[0] = buf[pos];
|
|
1114
|
+
f8b[1] = buf[pos + 1];
|
|
1115
|
+
f8b[2] = buf[pos + 2];
|
|
1116
|
+
f8b[3] = buf[pos + 3];
|
|
1117
|
+
return f32[0];
|
|
1118
|
+
}
|
|
1119
|
+
function readFloat_f32_rev(buf, pos) {
|
|
1120
|
+
f8b[3] = buf[pos];
|
|
1121
|
+
f8b[2] = buf[pos + 1];
|
|
1122
|
+
f8b[1] = buf[pos + 2];
|
|
1123
|
+
f8b[0] = buf[pos + 3];
|
|
1124
|
+
return f32[0];
|
|
1125
|
+
}
|
|
1126
|
+
exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;
|
|
1127
|
+
exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;
|
|
1128
|
+
})();
|
|
1129
|
+
else (function() {
|
|
1130
|
+
function writeFloat_ieee754(writeUint, val, buf, pos) {
|
|
1131
|
+
var sign = val < 0 ? 1 : 0;
|
|
1132
|
+
if (sign)
|
|
1133
|
+
val = -val;
|
|
1134
|
+
if (val === 0)
|
|
1135
|
+
writeUint(1 / val > 0 ? (
|
|
1136
|
+
/* positive */
|
|
1137
|
+
0
|
|
1138
|
+
) : (
|
|
1139
|
+
/* negative 0 */
|
|
1140
|
+
2147483648
|
|
1141
|
+
), buf, pos);
|
|
1142
|
+
else if (isNaN(val))
|
|
1143
|
+
writeUint(2143289344, buf, pos);
|
|
1144
|
+
else if (val > 34028234663852886e22)
|
|
1145
|
+
writeUint((sign << 31 | 2139095040) >>> 0, buf, pos);
|
|
1146
|
+
else if (val < 11754943508222875e-54)
|
|
1147
|
+
writeUint((sign << 31 | Math.round(val / 1401298464324817e-60)) >>> 0, buf, pos);
|
|
1148
|
+
else {
|
|
1149
|
+
var exponent = Math.floor(Math.log(val) / Math.LN2), mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
|
|
1150
|
+
writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);
|
|
1154
|
+
exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);
|
|
1155
|
+
function readFloat_ieee754(readUint, buf, pos) {
|
|
1156
|
+
var uint = readUint(buf, pos), sign = (uint >> 31) * 2 + 1, exponent = uint >>> 23 & 255, mantissa = uint & 8388607;
|
|
1157
|
+
return exponent === 255 ? mantissa ? NaN : sign * Infinity : exponent === 0 ? sign * 1401298464324817e-60 * mantissa : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608);
|
|
1158
|
+
}
|
|
1159
|
+
exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE);
|
|
1160
|
+
exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
|
|
1161
|
+
})();
|
|
1162
|
+
if (typeof Float64Array !== "undefined") (function() {
|
|
1163
|
+
var f64 = new Float64Array([-0]), f8b = new Uint8Array(f64.buffer), le = f8b[7] === 128;
|
|
1164
|
+
function writeDouble_f64_cpy(val, buf, pos) {
|
|
1165
|
+
f64[0] = val;
|
|
1166
|
+
buf[pos] = f8b[0];
|
|
1167
|
+
buf[pos + 1] = f8b[1];
|
|
1168
|
+
buf[pos + 2] = f8b[2];
|
|
1169
|
+
buf[pos + 3] = f8b[3];
|
|
1170
|
+
buf[pos + 4] = f8b[4];
|
|
1171
|
+
buf[pos + 5] = f8b[5];
|
|
1172
|
+
buf[pos + 6] = f8b[6];
|
|
1173
|
+
buf[pos + 7] = f8b[7];
|
|
1174
|
+
}
|
|
1175
|
+
function writeDouble_f64_rev(val, buf, pos) {
|
|
1176
|
+
f64[0] = val;
|
|
1177
|
+
buf[pos] = f8b[7];
|
|
1178
|
+
buf[pos + 1] = f8b[6];
|
|
1179
|
+
buf[pos + 2] = f8b[5];
|
|
1180
|
+
buf[pos + 3] = f8b[4];
|
|
1181
|
+
buf[pos + 4] = f8b[3];
|
|
1182
|
+
buf[pos + 5] = f8b[2];
|
|
1183
|
+
buf[pos + 6] = f8b[1];
|
|
1184
|
+
buf[pos + 7] = f8b[0];
|
|
1185
|
+
}
|
|
1186
|
+
exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;
|
|
1187
|
+
exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;
|
|
1188
|
+
function readDouble_f64_cpy(buf, pos) {
|
|
1189
|
+
f8b[0] = buf[pos];
|
|
1190
|
+
f8b[1] = buf[pos + 1];
|
|
1191
|
+
f8b[2] = buf[pos + 2];
|
|
1192
|
+
f8b[3] = buf[pos + 3];
|
|
1193
|
+
f8b[4] = buf[pos + 4];
|
|
1194
|
+
f8b[5] = buf[pos + 5];
|
|
1195
|
+
f8b[6] = buf[pos + 6];
|
|
1196
|
+
f8b[7] = buf[pos + 7];
|
|
1197
|
+
return f64[0];
|
|
1198
|
+
}
|
|
1199
|
+
function readDouble_f64_rev(buf, pos) {
|
|
1200
|
+
f8b[7] = buf[pos];
|
|
1201
|
+
f8b[6] = buf[pos + 1];
|
|
1202
|
+
f8b[5] = buf[pos + 2];
|
|
1203
|
+
f8b[4] = buf[pos + 3];
|
|
1204
|
+
f8b[3] = buf[pos + 4];
|
|
1205
|
+
f8b[2] = buf[pos + 5];
|
|
1206
|
+
f8b[1] = buf[pos + 6];
|
|
1207
|
+
f8b[0] = buf[pos + 7];
|
|
1208
|
+
return f64[0];
|
|
1209
|
+
}
|
|
1210
|
+
exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;
|
|
1211
|
+
exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;
|
|
1212
|
+
})();
|
|
1213
|
+
else (function() {
|
|
1214
|
+
function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {
|
|
1215
|
+
var sign = val < 0 ? 1 : 0;
|
|
1216
|
+
if (sign)
|
|
1217
|
+
val = -val;
|
|
1218
|
+
if (val === 0) {
|
|
1219
|
+
writeUint(0, buf, pos + off0);
|
|
1220
|
+
writeUint(1 / val > 0 ? (
|
|
1221
|
+
/* positive */
|
|
1222
|
+
0
|
|
1223
|
+
) : (
|
|
1224
|
+
/* negative 0 */
|
|
1225
|
+
2147483648
|
|
1226
|
+
), buf, pos + off1);
|
|
1227
|
+
} else if (isNaN(val)) {
|
|
1228
|
+
writeUint(0, buf, pos + off0);
|
|
1229
|
+
writeUint(2146959360, buf, pos + off1);
|
|
1230
|
+
} else if (val > 17976931348623157e292) {
|
|
1231
|
+
writeUint(0, buf, pos + off0);
|
|
1232
|
+
writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1);
|
|
1233
|
+
} else {
|
|
1234
|
+
var mantissa;
|
|
1235
|
+
if (val < 22250738585072014e-324) {
|
|
1236
|
+
mantissa = val / 5e-324;
|
|
1237
|
+
writeUint(mantissa >>> 0, buf, pos + off0);
|
|
1238
|
+
writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
|
|
1250
1239
|
} else {
|
|
1251
|
-
var
|
|
1252
|
-
if (
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
var exponent = Math.floor(Math.log(val) / Math.LN2);
|
|
1258
|
-
if (exponent === 1024)
|
|
1259
|
-
exponent = 1023;
|
|
1260
|
-
mantissa = val * Math.pow(2, -exponent);
|
|
1261
|
-
writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
|
|
1262
|
-
writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
|
|
1263
|
-
}
|
|
1240
|
+
var exponent = Math.floor(Math.log(val) / Math.LN2);
|
|
1241
|
+
if (exponent === 1024)
|
|
1242
|
+
exponent = 1023;
|
|
1243
|
+
mantissa = val * Math.pow(2, -exponent);
|
|
1244
|
+
writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
|
|
1245
|
+
writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
|
|
1264
1246
|
}
|
|
1265
1247
|
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1248
|
+
}
|
|
1249
|
+
exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);
|
|
1250
|
+
exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);
|
|
1251
|
+
function readDouble_ieee754(readUint, off0, off1, buf, pos) {
|
|
1252
|
+
var lo = readUint(buf, pos + off0), hi = readUint(buf, pos + off1);
|
|
1253
|
+
var sign = (hi >> 31) * 2 + 1, exponent = hi >>> 20 & 2047, mantissa = 4294967296 * (hi & 1048575) + lo;
|
|
1254
|
+
return exponent === 2047 ? mantissa ? NaN : sign * Infinity : exponent === 0 ? sign * 5e-324 * mantissa : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
|
|
1255
|
+
}
|
|
1256
|
+
exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);
|
|
1257
|
+
exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
|
|
1258
|
+
})();
|
|
1276
1259
|
return exports;
|
|
1277
1260
|
}
|
|
1278
1261
|
function writeUintLE(val, buf, pos) {
|
|
@@ -1398,8 +1381,7 @@ function pool(alloc2, slice, size) {
|
|
|
1398
1381
|
var longbits;
|
|
1399
1382
|
var hasRequiredLongbits;
|
|
1400
1383
|
function requireLongbits() {
|
|
1401
|
-
if (hasRequiredLongbits)
|
|
1402
|
-
return longbits;
|
|
1384
|
+
if (hasRequiredLongbits) return longbits;
|
|
1403
1385
|
hasRequiredLongbits = 1;
|
|
1404
1386
|
longbits = LongBits2;
|
|
1405
1387
|
var util2 = requireMinimal();
|
|
@@ -1500,8 +1482,7 @@ function requireLongbits() {
|
|
|
1500
1482
|
}
|
|
1501
1483
|
var hasRequiredMinimal;
|
|
1502
1484
|
function requireMinimal() {
|
|
1503
|
-
if (hasRequiredMinimal)
|
|
1504
|
-
return minimal$1;
|
|
1485
|
+
if (hasRequiredMinimal) return minimal$1;
|
|
1505
1486
|
hasRequiredMinimal = 1;
|
|
1506
1487
|
(function(exports) {
|
|
1507
1488
|
var util2 = exports;
|
|
@@ -1871,9 +1852,8 @@ BufferWriter._configure = function() {
|
|
|
1871
1852
|
} : function writeBytesBuffer_copy(val, buf, pos) {
|
|
1872
1853
|
if (val.copy)
|
|
1873
1854
|
val.copy(buf, pos, 0, val.length);
|
|
1874
|
-
else
|
|
1875
|
-
|
|
1876
|
-
buf[pos++] = val[i++];
|
|
1855
|
+
else for (var i = 0; i < val.length; )
|
|
1856
|
+
buf[pos++] = val[i++];
|
|
1877
1857
|
};
|
|
1878
1858
|
};
|
|
1879
1859
|
BufferWriter.prototype.bytes = function write_bytes_buffer(value) {
|
|
@@ -1932,24 +1912,19 @@ var create = function create3() {
|
|
|
1932
1912
|
Reader$1.create = create();
|
|
1933
1913
|
Reader$1.prototype._slice = util$2.Array.prototype.subarray || /* istanbul ignore next */
|
|
1934
1914
|
util$2.Array.prototype.slice;
|
|
1935
|
-
Reader$1.prototype.uint32 = function read_uint32_setup() {
|
|
1915
|
+
Reader$1.prototype.uint32 = /* @__PURE__ */ function read_uint32_setup() {
|
|
1936
1916
|
var value = 4294967295;
|
|
1937
1917
|
return function read_uint32() {
|
|
1938
1918
|
value = (this.buf[this.pos] & 127) >>> 0;
|
|
1939
|
-
if (this.buf[this.pos++] < 128)
|
|
1940
|
-
return value;
|
|
1919
|
+
if (this.buf[this.pos++] < 128) return value;
|
|
1941
1920
|
value = (value | (this.buf[this.pos] & 127) << 7) >>> 0;
|
|
1942
|
-
if (this.buf[this.pos++] < 128)
|
|
1943
|
-
return value;
|
|
1921
|
+
if (this.buf[this.pos++] < 128) return value;
|
|
1944
1922
|
value = (value | (this.buf[this.pos] & 127) << 14) >>> 0;
|
|
1945
|
-
if (this.buf[this.pos++] < 128)
|
|
1946
|
-
return value;
|
|
1923
|
+
if (this.buf[this.pos++] < 128) return value;
|
|
1947
1924
|
value = (value | (this.buf[this.pos] & 127) << 21) >>> 0;
|
|
1948
|
-
if (this.buf[this.pos++] < 128)
|
|
1949
|
-
return value;
|
|
1925
|
+
if (this.buf[this.pos++] < 128) return value;
|
|
1950
1926
|
value = (value | (this.buf[this.pos] & 15) << 28) >>> 0;
|
|
1951
|
-
if (this.buf[this.pos++] < 128)
|
|
1952
|
-
return value;
|
|
1927
|
+
if (this.buf[this.pos++] < 128) return value;
|
|
1953
1928
|
if ((this.pos += 5) > this.len) {
|
|
1954
1929
|
this.pos = this.len;
|
|
1955
1930
|
throw indexOutOfRange(this, 10);
|
|
@@ -2363,7 +2338,11 @@ function createBaseInstrumentDefinition() {
|
|
|
2363
2338
|
commodity: "",
|
|
2364
2339
|
exchangeId: 0,
|
|
2365
2340
|
priceScalingExponent: 0,
|
|
2366
|
-
underlyingOpenfeedMarketId: Long.ZERO
|
|
2341
|
+
underlyingOpenfeedMarketId: Long.ZERO,
|
|
2342
|
+
barchartExchange: "",
|
|
2343
|
+
contractSize: Long.ZERO,
|
|
2344
|
+
contractSizeDescription: "",
|
|
2345
|
+
exchangeMetadata: void 0
|
|
2367
2346
|
};
|
|
2368
2347
|
}
|
|
2369
2348
|
const InstrumentDefinitionDecode = {
|
|
@@ -2741,6 +2720,30 @@ const InstrumentDefinitionDecode = {
|
|
|
2741
2720
|
}
|
|
2742
2721
|
message.underlyingOpenfeedMarketId = reader2.sint64();
|
|
2743
2722
|
continue;
|
|
2723
|
+
case 236:
|
|
2724
|
+
if (tag !== 1890) {
|
|
2725
|
+
break;
|
|
2726
|
+
}
|
|
2727
|
+
message.barchartExchange = reader2.string();
|
|
2728
|
+
continue;
|
|
2729
|
+
case 237:
|
|
2730
|
+
if (tag !== 1896) {
|
|
2731
|
+
break;
|
|
2732
|
+
}
|
|
2733
|
+
message.contractSize = reader2.sint64();
|
|
2734
|
+
continue;
|
|
2735
|
+
case 238:
|
|
2736
|
+
if (tag !== 1906) {
|
|
2737
|
+
break;
|
|
2738
|
+
}
|
|
2739
|
+
message.contractSizeDescription = reader2.string();
|
|
2740
|
+
continue;
|
|
2741
|
+
case 239:
|
|
2742
|
+
if (tag !== 1914) {
|
|
2743
|
+
break;
|
|
2744
|
+
}
|
|
2745
|
+
message.exchangeMetadata = InstrumentDefinition_ExchangeMetadataDecode.decode(reader2, reader2.uint32());
|
|
2746
|
+
continue;
|
|
2744
2747
|
}
|
|
2745
2748
|
if ((tag & 7) === 4 || tag === 0) {
|
|
2746
2749
|
break;
|
|
@@ -3074,6 +3077,50 @@ const InstrumentDefinition_CurrencyPairDecode = {
|
|
|
3074
3077
|
return message;
|
|
3075
3078
|
}
|
|
3076
3079
|
};
|
|
3080
|
+
function createBaseInstrumentDefinition_ExchangeMetadata() {
|
|
3081
|
+
return { securityId: Long.ZERO, channelId: "", sbeId: 0, underlyingSecurityId: Long.ZERO };
|
|
3082
|
+
}
|
|
3083
|
+
const InstrumentDefinition_ExchangeMetadataDecode = {
|
|
3084
|
+
decode(input, length) {
|
|
3085
|
+
const reader2 = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
|
|
3086
|
+
let end2 = length === void 0 ? reader2.len : reader2.pos + length;
|
|
3087
|
+
const message = createBaseInstrumentDefinition_ExchangeMetadata();
|
|
3088
|
+
while (reader2.pos < end2) {
|
|
3089
|
+
const tag = reader2.uint32();
|
|
3090
|
+
switch (tag >>> 3) {
|
|
3091
|
+
case 1:
|
|
3092
|
+
if (tag !== 8) {
|
|
3093
|
+
break;
|
|
3094
|
+
}
|
|
3095
|
+
message.securityId = reader2.sint64();
|
|
3096
|
+
continue;
|
|
3097
|
+
case 2:
|
|
3098
|
+
if (tag !== 18) {
|
|
3099
|
+
break;
|
|
3100
|
+
}
|
|
3101
|
+
message.channelId = reader2.string();
|
|
3102
|
+
continue;
|
|
3103
|
+
case 3:
|
|
3104
|
+
if (tag !== 24) {
|
|
3105
|
+
break;
|
|
3106
|
+
}
|
|
3107
|
+
message.sbeId = reader2.sint32();
|
|
3108
|
+
continue;
|
|
3109
|
+
case 4:
|
|
3110
|
+
if (tag !== 32) {
|
|
3111
|
+
break;
|
|
3112
|
+
}
|
|
3113
|
+
message.underlyingSecurityId = reader2.sint64();
|
|
3114
|
+
continue;
|
|
3115
|
+
}
|
|
3116
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
3117
|
+
break;
|
|
3118
|
+
}
|
|
3119
|
+
reader2.skipType(tag & 7);
|
|
3120
|
+
}
|
|
3121
|
+
return message;
|
|
3122
|
+
}
|
|
3123
|
+
};
|
|
3077
3124
|
if (_m0.util.Long !== Long) {
|
|
3078
3125
|
_m0.util.Long = Long;
|
|
3079
3126
|
_m0.configure();
|
|
@@ -8356,10 +8403,8 @@ class OpenFeedConnection {
|
|
|
8356
8403
|
const { correlationId, instrumentDefinition, numberOfDefinitions } = message.instrumentResponse;
|
|
8357
8404
|
const idString = correlationId.toString();
|
|
8358
8405
|
const request = this.instrumentRequests.get(idString);
|
|
8359
|
-
if (!request)
|
|
8360
|
-
|
|
8361
|
-
if (!instrumentDefinition)
|
|
8362
|
-
throw new Error(`Instrument definition not found in response ID ${idString}`);
|
|
8406
|
+
if (!request) throw new Error(`Instrument request ID ${idString} not found`);
|
|
8407
|
+
if (!instrumentDefinition) throw new Error(`Instrument definition not found in response ID ${idString}`);
|
|
8363
8408
|
let definitions = this.definitionsInFlight.get(idString);
|
|
8364
8409
|
if (!definitions) {
|
|
8365
8410
|
definitions = [instrumentDefinition];
|
|
@@ -8377,16 +8422,14 @@ class OpenFeedConnection {
|
|
|
8377
8422
|
if (message.instrumentReferenceResponse) {
|
|
8378
8423
|
const { correlationId } = message.instrumentReferenceResponse;
|
|
8379
8424
|
const request = this.instrumentReferenceRequests.get(correlationId.toString());
|
|
8380
|
-
if (!request)
|
|
8381
|
-
throw new Error(`Exchange request ID ${correlationId} not found`);
|
|
8425
|
+
if (!request) throw new Error(`Exchange request ID ${correlationId} not found`);
|
|
8382
8426
|
request.resolve(message.instrumentReferenceResponse);
|
|
8383
8427
|
continue;
|
|
8384
8428
|
}
|
|
8385
8429
|
if (message.exchangeResponse) {
|
|
8386
8430
|
const { correlationId } = message.exchangeResponse;
|
|
8387
8431
|
const request = this.exchangeRequests.get(correlationId.toString());
|
|
8388
|
-
if (!request)
|
|
8389
|
-
throw new Error(`Exchange request ID ${correlationId} not found`);
|
|
8432
|
+
if (!request) throw new Error(`Exchange request ID ${correlationId} not found`);
|
|
8390
8433
|
request.resolve(message.exchangeResponse);
|
|
8391
8434
|
continue;
|
|
8392
8435
|
}
|
|
@@ -8394,8 +8437,7 @@ class OpenFeedConnection {
|
|
|
8394
8437
|
const { correlationId, unsubscribe } = message.subscriptionResponse;
|
|
8395
8438
|
if (!unsubscribe) {
|
|
8396
8439
|
const request = this.subscriptionRequests.get(correlationId.toString());
|
|
8397
|
-
if (!request)
|
|
8398
|
-
throw new Error(`Subscription response ID ${correlationId} not found`);
|
|
8440
|
+
if (!request) throw new Error(`Subscription response ID ${correlationId} not found`);
|
|
8399
8441
|
const [, sub] = request;
|
|
8400
8442
|
sub.resolve();
|
|
8401
8443
|
}
|
|
@@ -8600,14 +8642,14 @@ class OpenFeedConnection {
|
|
|
8600
8642
|
}
|
|
8601
8643
|
}
|
|
8602
8644
|
}
|
|
8603
|
-
const version = "1.
|
|
8645
|
+
const version = "1.4.1";
|
|
8604
8646
|
const getClientVersion = async (clientId) => {
|
|
8605
8647
|
var _a, _b, _c, _d, _e, _f;
|
|
8606
8648
|
let platformDescription;
|
|
8607
8649
|
if (typeof window !== "undefined") {
|
|
8608
8650
|
platformDescription = navigator.userAgent;
|
|
8609
8651
|
} else {
|
|
8610
|
-
const os = await import("./empty-
|
|
8652
|
+
const os = await import("./empty-BvAKRCY4.js");
|
|
8611
8653
|
try {
|
|
8612
8654
|
platformDescription = `Node.js ${process.version}; ${(_a = os.version) == null ? void 0 : _a.call(os)} ${(_b = os.release) == null ? void 0 : _b.call(os)}; ${(_c = os.arch) == null ? void 0 : _c.call(os)};`;
|
|
8613
8655
|
} catch (e) {
|
|
@@ -8628,8 +8670,7 @@ class OpenFeedClient {
|
|
|
8628
8670
|
__publicField(this, "subscribeResetSource", new ResolutionSource());
|
|
8629
8671
|
__publicField(this, "subscriptions", /* @__PURE__ */ new Map());
|
|
8630
8672
|
__publicField(this, "onOpen", async () => {
|
|
8631
|
-
if (!this.socket)
|
|
8632
|
-
return;
|
|
8673
|
+
if (!this.socket) return;
|
|
8633
8674
|
const clientVersion = await getClientVersion(this.clientId);
|
|
8634
8675
|
const loginRequest = {
|
|
8635
8676
|
loginRequest: {
|
|
@@ -8663,6 +8704,7 @@ class OpenFeedClient {
|
|
|
8663
8704
|
this.loopResetSource.reject(e);
|
|
8664
8705
|
}
|
|
8665
8706
|
} finally {
|
|
8707
|
+
await this.listeners.onCleanup();
|
|
8666
8708
|
await this.listeners.onDisconnected();
|
|
8667
8709
|
this.loopResetSource.resolve();
|
|
8668
8710
|
}
|
|
@@ -8690,7 +8732,7 @@ class OpenFeedClient {
|
|
|
8690
8732
|
}
|
|
8691
8733
|
});
|
|
8692
8734
|
__publicField(this, "runConnectLoop", async () => {
|
|
8693
|
-
var _a, _b;
|
|
8735
|
+
var _a, _b, _c;
|
|
8694
8736
|
for (; ; ) {
|
|
8695
8737
|
if (this.socket) {
|
|
8696
8738
|
if (this.socket.readyState !== WebSocket$1.CLOSED && this.socket.readyState !== WebSocket$1.CLOSING) {
|
|
@@ -8708,6 +8750,7 @@ class OpenFeedClient {
|
|
|
8708
8750
|
await this.whenConnectedInternalSource.whenCompleted;
|
|
8709
8751
|
await this.loopResetSource.whenCompleted;
|
|
8710
8752
|
} catch (e) {
|
|
8753
|
+
(_a = this.logger) == null ? void 0 : _a.error("Error when connecting to socket:", e);
|
|
8711
8754
|
const socket = this.socket;
|
|
8712
8755
|
socket.onerror = () => {
|
|
8713
8756
|
};
|
|
@@ -8719,13 +8762,14 @@ class OpenFeedClient {
|
|
|
8719
8762
|
socket.close(1e3, "Socket closed");
|
|
8720
8763
|
}
|
|
8721
8764
|
if (e instanceof DuplicateLoginError || e instanceof InvalidCredentialsError) {
|
|
8722
|
-
(
|
|
8765
|
+
(_b = this.logger) == null ? void 0 : _b.warn("Stopping the client because of unrecoverable error");
|
|
8723
8766
|
await this.listeners.onCredentialsRejected();
|
|
8724
8767
|
this.cleanUp();
|
|
8725
8768
|
break;
|
|
8726
8769
|
}
|
|
8727
8770
|
if (e instanceof ConnectionDisposedError) {
|
|
8728
|
-
(
|
|
8771
|
+
(_c = this.logger) == null ? void 0 : _c.warn("Stopping the client because of disposal");
|
|
8772
|
+
await this.listeners.onCleanup();
|
|
8729
8773
|
await this.listeners.onDisconnected();
|
|
8730
8774
|
this.cleanUp();
|
|
8731
8775
|
break;
|
|
@@ -8818,8 +8862,7 @@ class OpenFeedClient {
|
|
|
8818
8862
|
this.runConnectLoop();
|
|
8819
8863
|
}
|
|
8820
8864
|
get connection() {
|
|
8821
|
-
if (this._connection)
|
|
8822
|
-
return Promise.resolve(this._connection);
|
|
8865
|
+
if (this._connection) return Promise.resolve(this._connection);
|
|
8823
8866
|
if (this.whenConnectedSource.completed) {
|
|
8824
8867
|
throw new ConnectionDisposedError("Connection disposed");
|
|
8825
8868
|
}
|
|
@@ -8847,6 +8890,9 @@ const IDGetters = [
|
|
|
8847
8890
|
class OpenFeedListeners {
|
|
8848
8891
|
constructor() {
|
|
8849
8892
|
__publicField(this, "instrumentByMarketId", /* @__PURE__ */ new Map());
|
|
8893
|
+
__publicField(this, "cleanUp", () => {
|
|
8894
|
+
this.instrumentByMarketId.clear();
|
|
8895
|
+
});
|
|
8850
8896
|
__publicField(this, "addDetails", (message) => {
|
|
8851
8897
|
var _a, _b, _c;
|
|
8852
8898
|
let def;
|
|
@@ -8934,6 +8980,8 @@ class OpenFeedListeners {
|
|
|
8934
8980
|
return this.onMessageWithMetadata(message, uniqueSymbols, def);
|
|
8935
8981
|
});
|
|
8936
8982
|
/* eslint-disable class-methods-use-this */
|
|
8983
|
+
__publicField(this, "onCleanup", () => {
|
|
8984
|
+
});
|
|
8937
8985
|
__publicField(this, "onConnected", () => {
|
|
8938
8986
|
});
|
|
8939
8987
|
__publicField(this, "onCredentialsRejected", () => {
|
|
@@ -8947,6 +8995,7 @@ class OpenFeedListeners {
|
|
|
8947
8995
|
__publicField(this, "onHeartBeat", () => {
|
|
8948
8996
|
});
|
|
8949
8997
|
this.onMessage = this.addDetails;
|
|
8998
|
+
this.onCleanup = this.cleanUp;
|
|
8950
8999
|
}
|
|
8951
9000
|
/* eslint-enable class-methods-use-this */
|
|
8952
9001
|
}
|
package/dist/node.js
CHANGED
|
@@ -5977,7 +5977,11 @@ function createBaseInstrumentDefinition() {
|
|
|
5977
5977
|
commodity: "",
|
|
5978
5978
|
exchangeId: 0,
|
|
5979
5979
|
priceScalingExponent: 0,
|
|
5980
|
-
underlyingOpenfeedMarketId: long_default.ZERO
|
|
5980
|
+
underlyingOpenfeedMarketId: long_default.ZERO,
|
|
5981
|
+
barchartExchange: "",
|
|
5982
|
+
contractSize: long_default.ZERO,
|
|
5983
|
+
contractSizeDescription: "",
|
|
5984
|
+
exchangeMetadata: void 0
|
|
5981
5985
|
};
|
|
5982
5986
|
}
|
|
5983
5987
|
var InstrumentDefinitionDecode = {
|
|
@@ -6355,6 +6359,30 @@ var InstrumentDefinitionDecode = {
|
|
|
6355
6359
|
}
|
|
6356
6360
|
message.underlyingOpenfeedMarketId = reader.sint64();
|
|
6357
6361
|
continue;
|
|
6362
|
+
case 236:
|
|
6363
|
+
if (tag !== 1890) {
|
|
6364
|
+
break;
|
|
6365
|
+
}
|
|
6366
|
+
message.barchartExchange = reader.string();
|
|
6367
|
+
continue;
|
|
6368
|
+
case 237:
|
|
6369
|
+
if (tag !== 1896) {
|
|
6370
|
+
break;
|
|
6371
|
+
}
|
|
6372
|
+
message.contractSize = reader.sint64();
|
|
6373
|
+
continue;
|
|
6374
|
+
case 238:
|
|
6375
|
+
if (tag !== 1906) {
|
|
6376
|
+
break;
|
|
6377
|
+
}
|
|
6378
|
+
message.contractSizeDescription = reader.string();
|
|
6379
|
+
continue;
|
|
6380
|
+
case 239:
|
|
6381
|
+
if (tag !== 1914) {
|
|
6382
|
+
break;
|
|
6383
|
+
}
|
|
6384
|
+
message.exchangeMetadata = InstrumentDefinition_ExchangeMetadataDecode.decode(reader, reader.uint32());
|
|
6385
|
+
continue;
|
|
6358
6386
|
}
|
|
6359
6387
|
if ((tag & 7) === 4 || tag === 0) {
|
|
6360
6388
|
break;
|
|
@@ -6688,6 +6716,50 @@ var InstrumentDefinition_CurrencyPairDecode = {
|
|
|
6688
6716
|
return message;
|
|
6689
6717
|
}
|
|
6690
6718
|
};
|
|
6719
|
+
function createBaseInstrumentDefinition_ExchangeMetadata() {
|
|
6720
|
+
return { securityId: long_default.ZERO, channelId: "", sbeId: 0, underlyingSecurityId: long_default.ZERO };
|
|
6721
|
+
}
|
|
6722
|
+
var InstrumentDefinition_ExchangeMetadataDecode = {
|
|
6723
|
+
decode(input, length) {
|
|
6724
|
+
const reader = input instanceof import_minimal.default.Reader ? input : import_minimal.default.Reader.create(input);
|
|
6725
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
6726
|
+
const message = createBaseInstrumentDefinition_ExchangeMetadata();
|
|
6727
|
+
while (reader.pos < end) {
|
|
6728
|
+
const tag = reader.uint32();
|
|
6729
|
+
switch (tag >>> 3) {
|
|
6730
|
+
case 1:
|
|
6731
|
+
if (tag !== 8) {
|
|
6732
|
+
break;
|
|
6733
|
+
}
|
|
6734
|
+
message.securityId = reader.sint64();
|
|
6735
|
+
continue;
|
|
6736
|
+
case 2:
|
|
6737
|
+
if (tag !== 18) {
|
|
6738
|
+
break;
|
|
6739
|
+
}
|
|
6740
|
+
message.channelId = reader.string();
|
|
6741
|
+
continue;
|
|
6742
|
+
case 3:
|
|
6743
|
+
if (tag !== 24) {
|
|
6744
|
+
break;
|
|
6745
|
+
}
|
|
6746
|
+
message.sbeId = reader.sint32();
|
|
6747
|
+
continue;
|
|
6748
|
+
case 4:
|
|
6749
|
+
if (tag !== 32) {
|
|
6750
|
+
break;
|
|
6751
|
+
}
|
|
6752
|
+
message.underlyingSecurityId = reader.sint64();
|
|
6753
|
+
continue;
|
|
6754
|
+
}
|
|
6755
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6756
|
+
break;
|
|
6757
|
+
}
|
|
6758
|
+
reader.skipType(tag & 7);
|
|
6759
|
+
}
|
|
6760
|
+
return message;
|
|
6761
|
+
}
|
|
6762
|
+
};
|
|
6691
6763
|
if (import_minimal.default.util.Long !== long_default) {
|
|
6692
6764
|
import_minimal.default.util.Long = long_default;
|
|
6693
6765
|
import_minimal.default.configure();
|
|
@@ -12233,7 +12305,7 @@ var OpenFeedConnection = class {
|
|
|
12233
12305
|
};
|
|
12234
12306
|
|
|
12235
12307
|
// generated/version.ts
|
|
12236
|
-
var version = "1.
|
|
12308
|
+
var version = "1.4.1";
|
|
12237
12309
|
|
|
12238
12310
|
// src/utilities/client_version.ts
|
|
12239
12311
|
var getClientVersion = async (clientId) => {
|
|
@@ -12308,6 +12380,7 @@ var OpenFeedClient = class {
|
|
|
12308
12380
|
this.loopResetSource.reject(e);
|
|
12309
12381
|
}
|
|
12310
12382
|
} finally {
|
|
12383
|
+
await this.listeners.onCleanup();
|
|
12311
12384
|
await this.listeners.onDisconnected();
|
|
12312
12385
|
this.loopResetSource.resolve();
|
|
12313
12386
|
}
|
|
@@ -12335,7 +12408,7 @@ var OpenFeedClient = class {
|
|
|
12335
12408
|
}
|
|
12336
12409
|
};
|
|
12337
12410
|
runConnectLoop = async () => {
|
|
12338
|
-
var _a, _b;
|
|
12411
|
+
var _a, _b, _c;
|
|
12339
12412
|
for (; ; ) {
|
|
12340
12413
|
if (this.socket) {
|
|
12341
12414
|
if (this.socket.readyState !== import_isomorphic_ws.default.CLOSED && this.socket.readyState !== import_isomorphic_ws.default.CLOSING) {
|
|
@@ -12353,6 +12426,7 @@ var OpenFeedClient = class {
|
|
|
12353
12426
|
await this.whenConnectedInternalSource.whenCompleted;
|
|
12354
12427
|
await this.loopResetSource.whenCompleted;
|
|
12355
12428
|
} catch (e) {
|
|
12429
|
+
(_a = this.logger) == null ? void 0 : _a.error("Error when connecting to socket:", e);
|
|
12356
12430
|
const socket = this.socket;
|
|
12357
12431
|
socket.onerror = () => {
|
|
12358
12432
|
};
|
|
@@ -12364,13 +12438,14 @@ var OpenFeedClient = class {
|
|
|
12364
12438
|
socket.close(1e3, "Socket closed");
|
|
12365
12439
|
}
|
|
12366
12440
|
if (e instanceof DuplicateLoginError || e instanceof InvalidCredentialsError) {
|
|
12367
|
-
(
|
|
12441
|
+
(_b = this.logger) == null ? void 0 : _b.warn("Stopping the client because of unrecoverable error");
|
|
12368
12442
|
await this.listeners.onCredentialsRejected();
|
|
12369
12443
|
this.cleanUp();
|
|
12370
12444
|
break;
|
|
12371
12445
|
}
|
|
12372
12446
|
if (e instanceof ConnectionDisposedError) {
|
|
12373
|
-
(
|
|
12447
|
+
(_c = this.logger) == null ? void 0 : _c.warn("Stopping the client because of disposal");
|
|
12448
|
+
await this.listeners.onCleanup();
|
|
12374
12449
|
await this.listeners.onDisconnected();
|
|
12375
12450
|
this.cleanUp();
|
|
12376
12451
|
break;
|
|
@@ -12487,7 +12562,11 @@ var OpenFeedListeners = class {
|
|
|
12487
12562
|
instrumentByMarketId = /* @__PURE__ */ new Map();
|
|
12488
12563
|
constructor() {
|
|
12489
12564
|
this.onMessage = this.addDetails;
|
|
12565
|
+
this.onCleanup = this.cleanUp;
|
|
12490
12566
|
}
|
|
12567
|
+
cleanUp = () => {
|
|
12568
|
+
this.instrumentByMarketId.clear();
|
|
12569
|
+
};
|
|
12491
12570
|
addDetails = (message) => {
|
|
12492
12571
|
var _a, _b, _c;
|
|
12493
12572
|
let def;
|
|
@@ -12575,6 +12654,8 @@ var OpenFeedListeners = class {
|
|
|
12575
12654
|
return this.onMessageWithMetadata(message, uniqueSymbols, def);
|
|
12576
12655
|
};
|
|
12577
12656
|
/* eslint-disable class-methods-use-this */
|
|
12657
|
+
onCleanup = () => {
|
|
12658
|
+
};
|
|
12578
12659
|
onConnected = () => {
|
|
12579
12660
|
};
|
|
12580
12661
|
onCredentialsRejected = () => {
|
|
@@ -5,7 +5,9 @@ import { IOpenFeedConnection } from "./interfaces";
|
|
|
5
5
|
export declare class OpenFeedListeners {
|
|
6
6
|
private readonly instrumentByMarketId;
|
|
7
7
|
constructor();
|
|
8
|
+
private cleanUp;
|
|
8
9
|
private addDetails;
|
|
10
|
+
onCleanup: () => void | Promise<void>;
|
|
9
11
|
onConnected: (connection: IOpenFeedConnection) => void | Promise<void>;
|
|
10
12
|
onCredentialsRejected: () => void | Promise<void>;
|
|
11
13
|
onDisconnected: () => void | Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfeed/sdk-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "JavaScript SDK for Barchart OpenFeed",
|
|
5
5
|
"main": "dist/node.js",
|
|
6
6
|
"browser": "dist/index.js",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"ts-proto": "^1.156.7",
|
|
52
52
|
"tsx": "^3.12.7",
|
|
53
53
|
"typescript": "^5.2.2",
|
|
54
|
-
"vite": "^
|
|
54
|
+
"vite": "^5.4.21",
|
|
55
55
|
"vite-plugin-checker": "^0.8.0"
|
|
56
56
|
},
|
|
57
57
|
"packageManager": "yarn@1.22.19",
|
|
File without changes
|