@openfeed/sdk-js 1.5.0 → 1.6.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.
@@ -0,0 +1,11 @@
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.5.0](https://github.com/openfeed-org/sdk-js/compare/1.4.1...1.5.0) (2026-01-21)
6
+
7
+
8
+ ### Features
9
+
10
+ * randomize reconnect and watch checks. ([27bc726](https://github.com/openfeed-org/sdk-js/commit/27bc72668c07a82ecbc8a0ba5395c964edbce59b))
11
+ * regenerate files from proto ([268f23e](https://github.com/openfeed-org/sdk-js/commit/268f23ed4f0d441c0b0b91709f5511272f4322fe))
package/CHANGELOG.md CHANGED
@@ -2,10 +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.0](https://github.com/openfeed-org/sdk-js/compare/1.4.1...1.5.0) (2026-01-21)
5
+ ## [1.6.0](https://github.com/openfeed-org/sdk-js/compare/1.5.0...1.6.0) (2026-01-22)
6
6
 
7
7
 
8
8
  ### Features
9
9
 
10
- * randomize reconnect and watch checks. ([27bc726](https://github.com/openfeed-org/sdk-js/commit/27bc72668c07a82ecbc8a0ba5395c964edbce59b))
11
- * regenerate files from proto ([268f23e](https://github.com/openfeed-org/sdk-js/commit/268f23ed4f0d441c0b0b91709f5511272f4322fe))
10
+ * expose instruments map data ([1750d6e](https://github.com/openfeed-org/sdk-js/commit/1750d6ed768bf1d38a719c84183e923def876ce7))
@@ -1 +1 @@
1
- export declare const version = "1.5.0";
1
+ export declare const version = "1.6.1";
package/dist/index.js CHANGED
@@ -8920,6 +8920,18 @@ class OpenFeedConnection {
8920
8920
  this.subscriptionRequests.delete(originalRequest.correlationId.toString());
8921
8921
  }
8922
8922
  }
8923
+ send = (msg) => {
8924
+ const correlationId = CorrelationId.create();
8925
+ const token = this.connectionToken;
8926
+ const msg2 = {};
8927
+ if (msg.exchangeRequest !== void 0) msg2.exchangeRequest = { ...msg.exchangeRequest, correlationId, token };
8928
+ else if (msg.instrumentReferenceRequest !== void 0) msg2.instrumentReferenceRequest = { ...msg.instrumentReferenceRequest, correlationId, token };
8929
+ else if (msg.instrumentRequest !== void 0) msg2.instrumentRequest = { ...msg.instrumentRequest, correlationId, token };
8930
+ else if (msg.listSubscriptionsRequest !== void 0) msg2.listSubscriptionsRequest = { ...msg.listSubscriptionsRequest, correlationId, token };
8931
+ else if (msg.subscriptionRequest !== void 0) msg2.subscriptionRequest = { ...msg.subscriptionRequest, correlationId, token };
8932
+ send(this.socket, msg2);
8933
+ return correlationId;
8934
+ };
8923
8935
  getExchanges = async () => {
8924
8936
  if (this.whenDisconnectedSource.completed) {
8925
8937
  throw new ConnectionDisposedError("This connection was closed");
@@ -8988,7 +9000,7 @@ class OpenFeedConnection {
8988
9000
  whenDisconnected = () => this.whenDisconnectedSource.whenCompleted;
8989
9001
  dispose = () => this.disconnect(new ConnectionDisposedError("Disposed"));
8990
9002
  }
8991
- const version = "1.5.0";
9003
+ const version = "1.6.1";
8992
9004
  const getClientVersion = async (clientId) => {
8993
9005
  let platformDescription;
8994
9006
  if (typeof window !== "undefined") {
@@ -9309,17 +9321,23 @@ class OpenFeedListeners {
9309
9321
  const uniqueSymbols = Array.from(new Set(symbols?.map(([symbol2]) => symbol2) ?? []));
9310
9322
  return this.onMessageWithMetadata(message, uniqueSymbols, def);
9311
9323
  };
9312
- /* eslint-disable class-methods-use-this */
9313
- onCleanup = () => {
9324
+ getInstrumentByMarketId = (marketId) => {
9325
+ const [definition] = this.instrumentByMarketId.get(marketId.toString()) ?? [void 0];
9326
+ return definition;
9314
9327
  };
9328
+ getSymbolsByMarketId = (marketId) => {
9329
+ const [, symbols] = this.instrumentByMarketId.get(marketId.toString()) ?? [void 0, void 0];
9330
+ return symbols?.map(([symbol2]) => symbol2) ?? [];
9331
+ };
9332
+ /* eslint-disable class-methods-use-this */
9333
+ onCleanup;
9315
9334
  onConnected = () => {
9316
9335
  };
9317
9336
  onCredentialsRejected = () => {
9318
9337
  };
9319
9338
  onDisconnected = () => {
9320
9339
  };
9321
- onMessage = () => {
9322
- };
9340
+ onMessage;
9323
9341
  onMessageWithMetadata = () => {
9324
9342
  };
9325
9343
  onHeartBeat = () => {
package/dist/node.js CHANGED
@@ -12618,6 +12618,18 @@ var OpenFeedConnection = class {
12618
12618
  this.subscriptionRequests.delete(originalRequest.correlationId.toString());
12619
12619
  }
12620
12620
  }
12621
+ send = (msg) => {
12622
+ const correlationId = CorrelationId.create();
12623
+ const token = this.connectionToken;
12624
+ const msg2 = {};
12625
+ if (msg.exchangeRequest !== void 0) msg2.exchangeRequest = { ...msg.exchangeRequest, correlationId, token };
12626
+ else if (msg.instrumentReferenceRequest !== void 0) msg2.instrumentReferenceRequest = { ...msg.instrumentReferenceRequest, correlationId, token };
12627
+ else if (msg.instrumentRequest !== void 0) msg2.instrumentRequest = { ...msg.instrumentRequest, correlationId, token };
12628
+ else if (msg.listSubscriptionsRequest !== void 0) msg2.listSubscriptionsRequest = { ...msg.listSubscriptionsRequest, correlationId, token };
12629
+ else if (msg.subscriptionRequest !== void 0) msg2.subscriptionRequest = { ...msg.subscriptionRequest, correlationId, token };
12630
+ send(this.socket, msg2);
12631
+ return correlationId;
12632
+ };
12621
12633
  getExchanges = async () => {
12622
12634
  var _a;
12623
12635
  if (this.whenDisconnectedSource.completed) {
@@ -12691,7 +12703,7 @@ var OpenFeedConnection = class {
12691
12703
  };
12692
12704
 
12693
12705
  // generated/version.ts
12694
- var version = "1.5.0";
12706
+ var version = "1.6.1";
12695
12707
 
12696
12708
  // src/utilities/client_version.ts
12697
12709
  var getClientVersion = async (clientId) => {
@@ -13037,17 +13049,23 @@ var OpenFeedListeners = class {
13037
13049
  const uniqueSymbols = Array.from(new Set((symbols == null ? void 0 : symbols.map(([symbol2]) => symbol2)) ?? []));
13038
13050
  return this.onMessageWithMetadata(message, uniqueSymbols, def);
13039
13051
  };
13040
- /* eslint-disable class-methods-use-this */
13041
- onCleanup = () => {
13052
+ getInstrumentByMarketId = (marketId) => {
13053
+ const [definition] = this.instrumentByMarketId.get(marketId.toString()) ?? [void 0];
13054
+ return definition;
13042
13055
  };
13056
+ getSymbolsByMarketId = (marketId) => {
13057
+ const [, symbols] = this.instrumentByMarketId.get(marketId.toString()) ?? [void 0, void 0];
13058
+ return (symbols == null ? void 0 : symbols.map(([symbol2]) => symbol2)) ?? [];
13059
+ };
13060
+ /* eslint-disable class-methods-use-this */
13061
+ onCleanup;
13043
13062
  onConnected = () => {
13044
13063
  };
13045
13064
  onCredentialsRejected = () => {
13046
13065
  };
13047
13066
  onDisconnected = () => {
13048
13067
  };
13049
- onMessage = () => {
13050
- };
13068
+ onMessage;
13051
13069
  onMessageWithMetadata = () => {
13052
13070
  };
13053
13071
  onHeartBeat = () => {
@@ -3,7 +3,7 @@ import Long from "long";
3
3
  import type { ExchangeResponse_Exchange, InstrumentReferenceResponse, SubscriptionType } from "@gen/openfeed_api";
4
4
  import type { InstrumentDefinition } from "@gen/openfeed_instrument";
5
5
  import type { Service } from "@gen/openfeed";
6
- import { IOpenFeedConnection, IOpenFeedLogger, OpenFeedInstrumentReferenceRequest, OpenFeedInstrumentRequest } from "./interfaces";
6
+ import { IOpenFeedConnection, IOpenFeedLogger, OpenFeedInstrumentReferenceRequest, OpenFeedInstrumentRequest, OpenfeedRequest } from "./interfaces";
7
7
  import { OpenFeedListeners } from "./listeners";
8
8
  export declare class OpenFeedConnection implements IOpenFeedConnection {
9
9
  private readonly connectionToken;
@@ -26,6 +26,7 @@ export declare class OpenFeedConnection implements IOpenFeedConnection {
26
26
  subscribe: (service: Service, subscriptionType: SubscriptionType, snapshotIntervalSeconds: number, symbols?: string[] | null, marketIds?: Long[] | null, exchanges?: string[] | null, channels?: number[] | null) => Long;
27
27
  unsubscribe: (subscriptionId: Long) => void;
28
28
  private fireUnsubscribeWhenReady;
29
+ send: (msg: OpenfeedRequest) => Long;
29
30
  getExchanges: () => Promise<ExchangeResponse_Exchange[]>;
30
31
  getInstrument: (request: OpenFeedInstrumentRequest) => Promise<InstrumentDefinition[]>;
31
32
  getInstrumentReference: (request: OpenFeedInstrumentReferenceRequest) => Promise<InstrumentReferenceResponse>;
@@ -1,10 +1,18 @@
1
1
  import Long from "long";
2
2
  import type { Service } from "@gen/openfeed";
3
- import type { ExchangeResponse_Exchange, InstrumentReferenceRequest, InstrumentReferenceResponse, InstrumentRequest, SubscriptionType } from "@gen/openfeed_api";
3
+ import type { ExchangeResponse_Exchange, InstrumentReferenceRequest, InstrumentReferenceResponse, InstrumentRequest, OpenfeedGatewayRequest, SubscriptionType } from "@gen/openfeed_api";
4
4
  import { OptionalUndefined } from "@src/utilities/messages";
5
5
  import type { InstrumentDefinition } from "@gen/openfeed_instrument";
6
6
  export type OpenFeedInstrumentRequest = Omit<OptionalUndefined<InstrumentRequest>, "correlationId" | "token" | "version">;
7
7
  export type OpenFeedInstrumentReferenceRequest = Omit<OptionalUndefined<InstrumentReferenceRequest>, "correlationId" | "token">;
8
+ type OmitDistributive<T, K extends PropertyKey> = T extends any ? (T extends object ? (T extends Long ? Long : Id<OmitRecursively<T, K>>) : T) : never;
9
+ type Id<T> = {} & {
10
+ [P in keyof T]: T[P];
11
+ };
12
+ type OmitRecursively<T, K extends PropertyKey> = Omit<{
13
+ [P in keyof T]: OmitDistributive<T[P], K>;
14
+ }, K>;
15
+ export type OpenfeedRequest = OmitRecursively<Omit<OpenfeedGatewayRequest, "loginRequest" | "logoutRequest">, "correlationId" | "token">;
8
16
  export interface IOpenFeedConnection {
9
17
  subscribe: (service: Service, subscriptionType: SubscriptionType, snapshotIntervalSeconds: number, symbols: string[] | null, marketIds: Long[] | null, exchanges: string[] | null, channels: number[] | null) => Long;
10
18
  unsubscribe: (subscriptionId: Long) => void;
@@ -12,6 +20,7 @@ export interface IOpenFeedConnection {
12
20
  getExchanges: () => Promise<ExchangeResponse_Exchange[]>;
13
21
  getInstrument: (request: OpenFeedInstrumentRequest) => Promise<InstrumentDefinition[]>;
14
22
  getInstrumentReference: (request: OpenFeedInstrumentReferenceRequest) => Promise<InstrumentReferenceResponse>;
23
+ send(msg: OpenfeedRequest): Long;
15
24
  }
16
25
  export interface IOpenFeedClient {
17
26
  get connection(): Promise<IOpenFeedConnection>;
@@ -24,3 +33,4 @@ export interface IOpenFeedLogger {
24
33
  warn: (...data: any[]) => void;
25
34
  error: (...data: any[]) => void;
26
35
  }
36
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { OpenfeedGatewayMessage } from "@gen/openfeed_api";
2
2
  import { InstrumentDefinition } from "@gen/openfeed_instrument";
3
+ import Long from "long";
3
4
  import { HeartBeat } from "@gen/openfeed";
4
5
  import { IOpenFeedConnection } from "./interfaces";
5
6
  export declare class OpenFeedListeners {
@@ -7,6 +8,8 @@ export declare class OpenFeedListeners {
7
8
  constructor();
8
9
  private cleanUp;
9
10
  private addDetails;
11
+ getInstrumentByMarketId: (marketId: Long) => InstrumentDefinition | undefined;
12
+ getSymbolsByMarketId: (marketId: Long) => string[];
10
13
  onCleanup: () => void | Promise<void>;
11
14
  onConnected: (connection: IOpenFeedConnection) => void | Promise<void>;
12
15
  onCredentialsRejected: () => void | Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfeed/sdk-js",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "description": "JavaScript SDK for Barchart OpenFeed",
5
5
  "main": "dist/node.js",
6
6
  "browser": "dist/index.js",