@openfeed/sdk-js 1.3.2 → 1.4.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.
@@ -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.2](https://github.com/openfeed-org/sdk-js/compare/1.3.1...1.3.2) (2025-01-23)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * address issues with subscription type and error subscription messages, expand tests ([8c82453](https://github.com/openfeed-org/sdk-js/commit/8c82453f18435418b30d1f5c37a6106bb1e50a65))
@@ -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))
package/CHANGELOG.md CHANGED
@@ -2,9 +2,14 @@
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.3.2](https://github.com/openfeed-org/sdk-js/compare/1.3.1...1.3.2) (2025-01-23)
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))
6
11
 
7
12
 
8
13
  ### Bug Fixes
9
14
 
10
- * address issues with subscription type and error subscription messages, expand tests ([8c82453](https://github.com/openfeed-org/sdk-js/commit/8c82453f18435418b30d1f5c37a6106bb1e50a65))
15
+ * extend error logging ([2c31557](https://github.com/openfeed-org/sdk-js/commit/2c315576f871abcaef985ae4a81c7f98b969e692))
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.3.2";
1
+ export declare const version = "1.4.0";
package/dist/index.js CHANGED
@@ -2363,7 +2363,11 @@ function createBaseInstrumentDefinition() {
2363
2363
  commodity: "",
2364
2364
  exchangeId: 0,
2365
2365
  priceScalingExponent: 0,
2366
- underlyingOpenfeedMarketId: Long.ZERO
2366
+ underlyingOpenfeedMarketId: Long.ZERO,
2367
+ barchartExchange: "",
2368
+ contractSize: Long.ZERO,
2369
+ contractSizeDescription: "",
2370
+ exchangeMetadata: void 0
2367
2371
  };
2368
2372
  }
2369
2373
  const InstrumentDefinitionDecode = {
@@ -2741,6 +2745,30 @@ const InstrumentDefinitionDecode = {
2741
2745
  }
2742
2746
  message.underlyingOpenfeedMarketId = reader2.sint64();
2743
2747
  continue;
2748
+ case 236:
2749
+ if (tag !== 1890) {
2750
+ break;
2751
+ }
2752
+ message.barchartExchange = reader2.string();
2753
+ continue;
2754
+ case 237:
2755
+ if (tag !== 1896) {
2756
+ break;
2757
+ }
2758
+ message.contractSize = reader2.sint64();
2759
+ continue;
2760
+ case 238:
2761
+ if (tag !== 1906) {
2762
+ break;
2763
+ }
2764
+ message.contractSizeDescription = reader2.string();
2765
+ continue;
2766
+ case 239:
2767
+ if (tag !== 1914) {
2768
+ break;
2769
+ }
2770
+ message.exchangeMetadata = InstrumentDefinition_ExchangeMetadataDecode.decode(reader2, reader2.uint32());
2771
+ continue;
2744
2772
  }
2745
2773
  if ((tag & 7) === 4 || tag === 0) {
2746
2774
  break;
@@ -3074,6 +3102,50 @@ const InstrumentDefinition_CurrencyPairDecode = {
3074
3102
  return message;
3075
3103
  }
3076
3104
  };
3105
+ function createBaseInstrumentDefinition_ExchangeMetadata() {
3106
+ return { securityId: Long.ZERO, channelId: "", sbeId: 0, underlyingSecurityId: Long.ZERO };
3107
+ }
3108
+ const InstrumentDefinition_ExchangeMetadataDecode = {
3109
+ decode(input, length) {
3110
+ const reader2 = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
3111
+ let end2 = length === void 0 ? reader2.len : reader2.pos + length;
3112
+ const message = createBaseInstrumentDefinition_ExchangeMetadata();
3113
+ while (reader2.pos < end2) {
3114
+ const tag = reader2.uint32();
3115
+ switch (tag >>> 3) {
3116
+ case 1:
3117
+ if (tag !== 8) {
3118
+ break;
3119
+ }
3120
+ message.securityId = reader2.sint64();
3121
+ continue;
3122
+ case 2:
3123
+ if (tag !== 18) {
3124
+ break;
3125
+ }
3126
+ message.channelId = reader2.string();
3127
+ continue;
3128
+ case 3:
3129
+ if (tag !== 24) {
3130
+ break;
3131
+ }
3132
+ message.sbeId = reader2.sint32();
3133
+ continue;
3134
+ case 4:
3135
+ if (tag !== 32) {
3136
+ break;
3137
+ }
3138
+ message.underlyingSecurityId = reader2.sint64();
3139
+ continue;
3140
+ }
3141
+ if ((tag & 7) === 4 || tag === 0) {
3142
+ break;
3143
+ }
3144
+ reader2.skipType(tag & 7);
3145
+ }
3146
+ return message;
3147
+ }
3148
+ };
3077
3149
  if (_m0.util.Long !== Long) {
3078
3150
  _m0.util.Long = Long;
3079
3151
  _m0.configure();
@@ -8600,7 +8672,7 @@ class OpenFeedConnection {
8600
8672
  }
8601
8673
  }
8602
8674
  }
8603
- const version = "1.3.2";
8675
+ const version = "1.4.0";
8604
8676
  const getClientVersion = async (clientId) => {
8605
8677
  var _a, _b, _c, _d, _e, _f;
8606
8678
  let platformDescription;
@@ -8690,7 +8762,7 @@ class OpenFeedClient {
8690
8762
  }
8691
8763
  });
8692
8764
  __publicField(this, "runConnectLoop", async () => {
8693
- var _a, _b;
8765
+ var _a, _b, _c;
8694
8766
  for (; ; ) {
8695
8767
  if (this.socket) {
8696
8768
  if (this.socket.readyState !== WebSocket$1.CLOSED && this.socket.readyState !== WebSocket$1.CLOSING) {
@@ -8708,6 +8780,7 @@ class OpenFeedClient {
8708
8780
  await this.whenConnectedInternalSource.whenCompleted;
8709
8781
  await this.loopResetSource.whenCompleted;
8710
8782
  } catch (e) {
8783
+ (_a = this.logger) == null ? void 0 : _a.error("Error when connecting to socket:", e);
8711
8784
  const socket = this.socket;
8712
8785
  socket.onerror = () => {
8713
8786
  };
@@ -8719,13 +8792,13 @@ class OpenFeedClient {
8719
8792
  socket.close(1e3, "Socket closed");
8720
8793
  }
8721
8794
  if (e instanceof DuplicateLoginError || e instanceof InvalidCredentialsError) {
8722
- (_a = this.logger) == null ? void 0 : _a.warn("Stopping the client because of unrecoverable error");
8795
+ (_b = this.logger) == null ? void 0 : _b.warn("Stopping the client because of unrecoverable error");
8723
8796
  await this.listeners.onCredentialsRejected();
8724
8797
  this.cleanUp();
8725
8798
  break;
8726
8799
  }
8727
8800
  if (e instanceof ConnectionDisposedError) {
8728
- (_b = this.logger) == null ? void 0 : _b.warn("Stopping the client because of disposal");
8801
+ (_c = this.logger) == null ? void 0 : _c.warn("Stopping the client because of disposal");
8729
8802
  await this.listeners.onDisconnected();
8730
8803
  this.cleanUp();
8731
8804
  break;
@@ -8856,29 +8929,33 @@ class OpenFeedListeners {
8856
8929
  return res ?? [void 0, void 0];
8857
8930
  };
8858
8931
  const includesSymbolSubscription = (arr, item) => {
8859
- return arr.some(([symbol, type]) => symbol === item[0] && type === item[1]);
8932
+ return arr.some(([symbol, correlationId]) => symbol === item[0] && correlationId === item[1]);
8860
8933
  };
8861
8934
  if (message.subscriptionResponse) {
8862
- const { marketId, symbol, unsubscribe, status, subscriptionType } = message.subscriptionResponse;
8935
+ const { marketId, symbol, unsubscribe, status, correlationId } = message.subscriptionResponse;
8936
+ const corIdStr = correlationId.toString();
8863
8937
  if (marketId !== Long.ZERO) {
8864
8938
  [def, symbols] = getInstrumentDefinition(marketId);
8865
8939
  if ((status == null ? void 0 : status.result) === Result.SUCCESS) {
8866
- const currentEntry = [symbol, subscriptionType];
8940
+ const currentEntry = [symbol, corIdStr];
8867
8941
  if (!unsubscribe) {
8868
8942
  if (!symbols) {
8869
8943
  symbols = [currentEntry];
8870
8944
  } else if (!includesSymbolSubscription(symbols, currentEntry)) {
8871
8945
  symbols = [...symbols, currentEntry];
8872
8946
  }
8947
+ this.instrumentByMarketId.set(marketId.toString(), [def, symbols]);
8873
8948
  } else {
8949
+ let symbolsToSave;
8874
8950
  if (symbols) {
8875
- symbols = symbols.filter(([s, t]) => !(s === symbol && t === subscriptionType));
8951
+ symbolsToSave = symbols.filter(([s, t]) => !(s === symbol && t === corIdStr));
8876
8952
  }
8877
- if (!symbols) {
8953
+ if (!(symbolsToSave == null ? void 0 : symbolsToSave.length)) {
8878
8954
  this.instrumentByMarketId.delete(marketId.toString());
8955
+ } else {
8956
+ this.instrumentByMarketId.set(marketId.toString(), [def, symbolsToSave]);
8879
8957
  }
8880
8958
  }
8881
- this.instrumentByMarketId.set(marketId.toString(), [def, symbols]);
8882
8959
  }
8883
8960
  }
8884
8961
  } else if (message.instrumentDefinition) {
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();
@@ -10825,19 +10897,19 @@ var Result = /* @__PURE__ */ ((Result2) => {
10825
10897
  Result2[Result2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
10826
10898
  return Result2;
10827
10899
  })(Result || {});
10828
- var SubscriptionType = /* @__PURE__ */ ((SubscriptionType3) => {
10829
- SubscriptionType3[SubscriptionType3["ALL"] = 0] = "ALL";
10830
- SubscriptionType3[SubscriptionType3["QUOTE"] = 1] = "QUOTE";
10831
- SubscriptionType3[SubscriptionType3["QUOTE_PARTICIPANT"] = 2] = "QUOTE_PARTICIPANT";
10832
- SubscriptionType3[SubscriptionType3["DEPTH_PRICE"] = 3] = "DEPTH_PRICE";
10833
- SubscriptionType3[SubscriptionType3["DEPTH_ORDER"] = 4] = "DEPTH_ORDER";
10834
- SubscriptionType3[SubscriptionType3["TRADES"] = 5] = "TRADES";
10835
- SubscriptionType3[SubscriptionType3["CUMULATIVE_VOLUME"] = 6] = "CUMULATIVE_VOLUME";
10836
- SubscriptionType3[SubscriptionType3["OHLC"] = 7] = "OHLC";
10837
- SubscriptionType3[SubscriptionType3["OHLC_NON_REGULAR"] = 8] = "OHLC_NON_REGULAR";
10838
- SubscriptionType3[SubscriptionType3["SETTLEMENT"] = 9] = "SETTLEMENT";
10839
- SubscriptionType3[SubscriptionType3["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
10840
- return SubscriptionType3;
10900
+ var SubscriptionType = /* @__PURE__ */ ((SubscriptionType2) => {
10901
+ SubscriptionType2[SubscriptionType2["ALL"] = 0] = "ALL";
10902
+ SubscriptionType2[SubscriptionType2["QUOTE"] = 1] = "QUOTE";
10903
+ SubscriptionType2[SubscriptionType2["QUOTE_PARTICIPANT"] = 2] = "QUOTE_PARTICIPANT";
10904
+ SubscriptionType2[SubscriptionType2["DEPTH_PRICE"] = 3] = "DEPTH_PRICE";
10905
+ SubscriptionType2[SubscriptionType2["DEPTH_ORDER"] = 4] = "DEPTH_ORDER";
10906
+ SubscriptionType2[SubscriptionType2["TRADES"] = 5] = "TRADES";
10907
+ SubscriptionType2[SubscriptionType2["CUMULATIVE_VOLUME"] = 6] = "CUMULATIVE_VOLUME";
10908
+ SubscriptionType2[SubscriptionType2["OHLC"] = 7] = "OHLC";
10909
+ SubscriptionType2[SubscriptionType2["OHLC_NON_REGULAR"] = 8] = "OHLC_NON_REGULAR";
10910
+ SubscriptionType2[SubscriptionType2["SETTLEMENT"] = 9] = "SETTLEMENT";
10911
+ SubscriptionType2[SubscriptionType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
10912
+ return SubscriptionType2;
10841
10913
  })(SubscriptionType || {});
10842
10914
  var SymbolType = /* @__PURE__ */ ((SymbolType2) => {
10843
10915
  SymbolType2[SymbolType2["BARCHART"] = 0] = "BARCHART";
@@ -12233,7 +12305,7 @@ var OpenFeedConnection = class {
12233
12305
  };
12234
12306
 
12235
12307
  // generated/version.ts
12236
- var version = "1.3.2";
12308
+ var version = "1.4.0";
12237
12309
 
12238
12310
  // src/utilities/client_version.ts
12239
12311
  var getClientVersion = async (clientId) => {
@@ -12335,7 +12407,7 @@ var OpenFeedClient = class {
12335
12407
  }
12336
12408
  };
12337
12409
  runConnectLoop = async () => {
12338
- var _a, _b;
12410
+ var _a, _b, _c;
12339
12411
  for (; ; ) {
12340
12412
  if (this.socket) {
12341
12413
  if (this.socket.readyState !== import_isomorphic_ws.default.CLOSED && this.socket.readyState !== import_isomorphic_ws.default.CLOSING) {
@@ -12353,6 +12425,7 @@ var OpenFeedClient = class {
12353
12425
  await this.whenConnectedInternalSource.whenCompleted;
12354
12426
  await this.loopResetSource.whenCompleted;
12355
12427
  } catch (e) {
12428
+ (_a = this.logger) == null ? void 0 : _a.error("Error when connecting to socket:", e);
12356
12429
  const socket = this.socket;
12357
12430
  socket.onerror = () => {
12358
12431
  };
@@ -12364,13 +12437,13 @@ var OpenFeedClient = class {
12364
12437
  socket.close(1e3, "Socket closed");
12365
12438
  }
12366
12439
  if (e instanceof DuplicateLoginError || e instanceof InvalidCredentialsError) {
12367
- (_a = this.logger) == null ? void 0 : _a.warn("Stopping the client because of unrecoverable error");
12440
+ (_b = this.logger) == null ? void 0 : _b.warn("Stopping the client because of unrecoverable error");
12368
12441
  await this.listeners.onCredentialsRejected();
12369
12442
  this.cleanUp();
12370
12443
  break;
12371
12444
  }
12372
12445
  if (e instanceof ConnectionDisposedError) {
12373
- (_b = this.logger) == null ? void 0 : _b.warn("Stopping the client because of disposal");
12446
+ (_c = this.logger) == null ? void 0 : _c.warn("Stopping the client because of disposal");
12374
12447
  await this.listeners.onDisconnected();
12375
12448
  this.cleanUp();
12376
12449
  break;
@@ -12497,29 +12570,33 @@ var OpenFeedListeners = class {
12497
12570
  return res ?? [void 0, void 0];
12498
12571
  };
12499
12572
  const includesSymbolSubscription = (arr, item) => {
12500
- return arr.some(([symbol, type]) => symbol === item[0] && type === item[1]);
12573
+ return arr.some(([symbol, correlationId]) => symbol === item[0] && correlationId === item[1]);
12501
12574
  };
12502
12575
  if (message.subscriptionResponse) {
12503
- const { marketId, symbol, unsubscribe, status, subscriptionType } = message.subscriptionResponse;
12576
+ const { marketId, symbol, unsubscribe, status, correlationId } = message.subscriptionResponse;
12577
+ const corIdStr = correlationId.toString();
12504
12578
  if (marketId !== long_default.ZERO) {
12505
12579
  [def, symbols] = getInstrumentDefinition(marketId);
12506
12580
  if ((status == null ? void 0 : status.result) === 1 /* SUCCESS */) {
12507
- const currentEntry = [symbol, subscriptionType];
12581
+ const currentEntry = [symbol, corIdStr];
12508
12582
  if (!unsubscribe) {
12509
12583
  if (!symbols) {
12510
12584
  symbols = [currentEntry];
12511
12585
  } else if (!includesSymbolSubscription(symbols, currentEntry)) {
12512
12586
  symbols = [...symbols, currentEntry];
12513
12587
  }
12588
+ this.instrumentByMarketId.set(marketId.toString(), [def, symbols]);
12514
12589
  } else {
12590
+ let symbolsToSave;
12515
12591
  if (symbols) {
12516
- symbols = symbols.filter(([s, t]) => !(s === symbol && t === subscriptionType));
12592
+ symbolsToSave = symbols.filter(([s, t]) => !(s === symbol && t === corIdStr));
12517
12593
  }
12518
- if (!symbols) {
12594
+ if (!(symbolsToSave == null ? void 0 : symbolsToSave.length)) {
12519
12595
  this.instrumentByMarketId.delete(marketId.toString());
12596
+ } else {
12597
+ this.instrumentByMarketId.set(marketId.toString(), [def, symbolsToSave]);
12520
12598
  }
12521
12599
  }
12522
- this.instrumentByMarketId.set(marketId.toString(), [def, symbols]);
12523
12600
  }
12524
12601
  }
12525
12602
  } else if (message.instrumentDefinition) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfeed/sdk-js",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "JavaScript SDK for Barchart OpenFeed",
5
5
  "main": "dist/node.js",
6
6
  "browser": "dist/index.js",