@openfeed/sdk-js 1.3.2 → 1.3.3

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))
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.3.2](https://github.com/openfeed-org/sdk-js/compare/1.3.1...1.3.2) (2025-01-23)
5
+ ### [1.3.3](https://github.com/openfeed-org/sdk-js/compare/1.3.2...1.3.3) (2025-03-28)
6
6
 
7
7
 
8
8
  ### Bug Fixes
9
9
 
10
- * address issues with subscription type and error subscription messages, expand tests ([8c82453](https://github.com/openfeed-org/sdk-js/commit/8c82453f18435418b30d1f5c37a6106bb1e50a65))
10
+ * take a better approach when identifying subscription responses - use correlation ([d841c79](https://github.com/openfeed-org/sdk-js/commit/d841c7996c068b10675e20832c413c4da466996a))
@@ -1 +1 @@
1
- export declare const version = "1.3.2";
1
+ export declare const version = "1.3.3";
package/dist/index.js CHANGED
@@ -8600,7 +8600,7 @@ class OpenFeedConnection {
8600
8600
  }
8601
8601
  }
8602
8602
  }
8603
- const version = "1.3.2";
8603
+ const version = "1.3.3";
8604
8604
  const getClientVersion = async (clientId) => {
8605
8605
  var _a, _b, _c, _d, _e, _f;
8606
8606
  let platformDescription;
@@ -8856,29 +8856,33 @@ class OpenFeedListeners {
8856
8856
  return res ?? [void 0, void 0];
8857
8857
  };
8858
8858
  const includesSymbolSubscription = (arr, item) => {
8859
- return arr.some(([symbol, type]) => symbol === item[0] && type === item[1]);
8859
+ return arr.some(([symbol, correlationId]) => symbol === item[0] && correlationId === item[1]);
8860
8860
  };
8861
8861
  if (message.subscriptionResponse) {
8862
- const { marketId, symbol, unsubscribe, status, subscriptionType } = message.subscriptionResponse;
8862
+ const { marketId, symbol, unsubscribe, status, correlationId } = message.subscriptionResponse;
8863
+ const corIdStr = correlationId.toString();
8863
8864
  if (marketId !== Long.ZERO) {
8864
8865
  [def, symbols] = getInstrumentDefinition(marketId);
8865
8866
  if ((status == null ? void 0 : status.result) === Result.SUCCESS) {
8866
- const currentEntry = [symbol, subscriptionType];
8867
+ const currentEntry = [symbol, corIdStr];
8867
8868
  if (!unsubscribe) {
8868
8869
  if (!symbols) {
8869
8870
  symbols = [currentEntry];
8870
8871
  } else if (!includesSymbolSubscription(symbols, currentEntry)) {
8871
8872
  symbols = [...symbols, currentEntry];
8872
8873
  }
8874
+ this.instrumentByMarketId.set(marketId.toString(), [def, symbols]);
8873
8875
  } else {
8876
+ let symbolsToSave;
8874
8877
  if (symbols) {
8875
- symbols = symbols.filter(([s, t]) => !(s === symbol && t === subscriptionType));
8878
+ symbolsToSave = symbols.filter(([s, t]) => !(s === symbol && t === corIdStr));
8876
8879
  }
8877
- if (!symbols) {
8880
+ if (!(symbolsToSave == null ? void 0 : symbolsToSave.length)) {
8878
8881
  this.instrumentByMarketId.delete(marketId.toString());
8882
+ } else {
8883
+ this.instrumentByMarketId.set(marketId.toString(), [def, symbolsToSave]);
8879
8884
  }
8880
8885
  }
8881
- this.instrumentByMarketId.set(marketId.toString(), [def, symbols]);
8882
8886
  }
8883
8887
  }
8884
8888
  } else if (message.instrumentDefinition) {
package/dist/node.js CHANGED
@@ -10825,19 +10825,19 @@ var Result = /* @__PURE__ */ ((Result2) => {
10825
10825
  Result2[Result2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
10826
10826
  return Result2;
10827
10827
  })(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;
10828
+ var SubscriptionType = /* @__PURE__ */ ((SubscriptionType2) => {
10829
+ SubscriptionType2[SubscriptionType2["ALL"] = 0] = "ALL";
10830
+ SubscriptionType2[SubscriptionType2["QUOTE"] = 1] = "QUOTE";
10831
+ SubscriptionType2[SubscriptionType2["QUOTE_PARTICIPANT"] = 2] = "QUOTE_PARTICIPANT";
10832
+ SubscriptionType2[SubscriptionType2["DEPTH_PRICE"] = 3] = "DEPTH_PRICE";
10833
+ SubscriptionType2[SubscriptionType2["DEPTH_ORDER"] = 4] = "DEPTH_ORDER";
10834
+ SubscriptionType2[SubscriptionType2["TRADES"] = 5] = "TRADES";
10835
+ SubscriptionType2[SubscriptionType2["CUMULATIVE_VOLUME"] = 6] = "CUMULATIVE_VOLUME";
10836
+ SubscriptionType2[SubscriptionType2["OHLC"] = 7] = "OHLC";
10837
+ SubscriptionType2[SubscriptionType2["OHLC_NON_REGULAR"] = 8] = "OHLC_NON_REGULAR";
10838
+ SubscriptionType2[SubscriptionType2["SETTLEMENT"] = 9] = "SETTLEMENT";
10839
+ SubscriptionType2[SubscriptionType2["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
10840
+ return SubscriptionType2;
10841
10841
  })(SubscriptionType || {});
10842
10842
  var SymbolType = /* @__PURE__ */ ((SymbolType2) => {
10843
10843
  SymbolType2[SymbolType2["BARCHART"] = 0] = "BARCHART";
@@ -12233,7 +12233,7 @@ var OpenFeedConnection = class {
12233
12233
  };
12234
12234
 
12235
12235
  // generated/version.ts
12236
- var version = "1.3.2";
12236
+ var version = "1.3.3";
12237
12237
 
12238
12238
  // src/utilities/client_version.ts
12239
12239
  var getClientVersion = async (clientId) => {
@@ -12497,29 +12497,33 @@ var OpenFeedListeners = class {
12497
12497
  return res ?? [void 0, void 0];
12498
12498
  };
12499
12499
  const includesSymbolSubscription = (arr, item) => {
12500
- return arr.some(([symbol, type]) => symbol === item[0] && type === item[1]);
12500
+ return arr.some(([symbol, correlationId]) => symbol === item[0] && correlationId === item[1]);
12501
12501
  };
12502
12502
  if (message.subscriptionResponse) {
12503
- const { marketId, symbol, unsubscribe, status, subscriptionType } = message.subscriptionResponse;
12503
+ const { marketId, symbol, unsubscribe, status, correlationId } = message.subscriptionResponse;
12504
+ const corIdStr = correlationId.toString();
12504
12505
  if (marketId !== long_default.ZERO) {
12505
12506
  [def, symbols] = getInstrumentDefinition(marketId);
12506
12507
  if ((status == null ? void 0 : status.result) === 1 /* SUCCESS */) {
12507
- const currentEntry = [symbol, subscriptionType];
12508
+ const currentEntry = [symbol, corIdStr];
12508
12509
  if (!unsubscribe) {
12509
12510
  if (!symbols) {
12510
12511
  symbols = [currentEntry];
12511
12512
  } else if (!includesSymbolSubscription(symbols, currentEntry)) {
12512
12513
  symbols = [...symbols, currentEntry];
12513
12514
  }
12515
+ this.instrumentByMarketId.set(marketId.toString(), [def, symbols]);
12514
12516
  } else {
12517
+ let symbolsToSave;
12515
12518
  if (symbols) {
12516
- symbols = symbols.filter(([s, t]) => !(s === symbol && t === subscriptionType));
12519
+ symbolsToSave = symbols.filter(([s, t]) => !(s === symbol && t === corIdStr));
12517
12520
  }
12518
- if (!symbols) {
12521
+ if (!(symbolsToSave == null ? void 0 : symbolsToSave.length)) {
12519
12522
  this.instrumentByMarketId.delete(marketId.toString());
12523
+ } else {
12524
+ this.instrumentByMarketId.set(marketId.toString(), [def, symbolsToSave]);
12520
12525
  }
12521
12526
  }
12522
- this.instrumentByMarketId.set(marketId.toString(), [def, symbols]);
12523
12527
  }
12524
12528
  }
12525
12529
  } 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.3.3",
4
4
  "description": "JavaScript SDK for Barchart OpenFeed",
5
5
  "main": "dist/node.js",
6
6
  "browser": "dist/index.js",