@openfeed/sdk-js 1.6.3 → 1.6.5

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.
@@ -1 +1 @@
1
- export declare const version = "1.6.3";
1
+ export declare const version = "1.6.5";
package/dist/index.js CHANGED
@@ -8666,19 +8666,21 @@ class CorrelationId {
8666
8666
  };
8667
8667
  }
8668
8668
  const toT = (obj) => obj;
8669
- function encodeMessages(message) {
8669
+ function encodeMessage(message) {
8670
8670
  return OpenfeedGatewayRequestEncode.encode(message).finish();
8671
8671
  }
8672
8672
  function send(socket, message) {
8673
- socket.send(encodeMessages(toT(message)));
8673
+ socket.send(encodeMessage(toT(message)));
8674
8674
  }
8675
8675
  const getShort = (a, b) => a << 8 | b << 0;
8676
8676
  function* decodeMessages(bytes) {
8677
8677
  let currentIndex = 0;
8678
- while (getShort(bytes[currentIndex], bytes[currentIndex + 1])) {
8679
- const shortVal = getShort(bytes[currentIndex], bytes[currentIndex + 1]) + 2;
8680
- const currentArray = bytes.subarray(currentIndex + 2, currentIndex + shortVal);
8681
- currentIndex += shortVal;
8678
+ while (currentIndex < bytes.length) {
8679
+ const len = getShort(bytes[currentIndex], bytes[currentIndex + 1]);
8680
+ if (len === 0) break;
8681
+ const total = len + 2;
8682
+ const currentArray = bytes.subarray(currentIndex + 2, currentIndex + total);
8683
+ currentIndex += total;
8682
8684
  yield OpenfeedGatewayMessageDecode.decode(currentArray);
8683
8685
  }
8684
8686
  }
@@ -9003,7 +9005,7 @@ class OpenFeedConnection {
9003
9005
  whenDisconnected = () => this.whenDisconnectedSource.whenCompleted;
9004
9006
  dispose = () => this.disconnect(new ConnectionDisposedError("Disposed"));
9005
9007
  }
9006
- const version = "1.6.3";
9008
+ const version = "1.6.5";
9007
9009
  const getClientVersion = async (clientId) => {
9008
9010
  let platformDescription;
9009
9011
  if (typeof window !== "undefined") {
@@ -9374,5 +9376,7 @@ export {
9374
9376
  SnapshotRequestResult,
9375
9377
  SnapshotRequest_SnapshotRequestType,
9376
9378
  SubscriptionType,
9377
- SymbolType
9379
+ SymbolType,
9380
+ decodeMessages,
9381
+ encodeMessage
9378
9382
  };
package/dist/node.js CHANGED
@@ -12354,19 +12354,21 @@ var CorrelationId = class {
12354
12354
  var toT = (obj) => obj;
12355
12355
 
12356
12356
  // src/utilities/communication.ts
12357
- function encodeMessages(message) {
12357
+ function encodeMessage(message) {
12358
12358
  return OpenfeedGatewayRequestEncode.encode(message).finish();
12359
12359
  }
12360
12360
  function send(socket, message) {
12361
- socket.send(encodeMessages(toT(message)));
12361
+ socket.send(encodeMessage(toT(message)));
12362
12362
  }
12363
12363
  var getShort = (a, b) => a << 8 | b << 0;
12364
12364
  function* decodeMessages(bytes) {
12365
12365
  let currentIndex = 0;
12366
- while (getShort(bytes[currentIndex], bytes[currentIndex + 1])) {
12367
- const shortVal = getShort(bytes[currentIndex], bytes[currentIndex + 1]) + 2;
12368
- const currentArray = bytes.subarray(currentIndex + 2, currentIndex + shortVal);
12369
- currentIndex += shortVal;
12366
+ while (currentIndex < bytes.length) {
12367
+ const len = getShort(bytes[currentIndex], bytes[currentIndex + 1]);
12368
+ if (len === 0) break;
12369
+ const total = len + 2;
12370
+ const currentArray = bytes.subarray(currentIndex + 2, currentIndex + total);
12371
+ currentIndex += total;
12370
12372
  yield OpenfeedGatewayMessageDecode.decode(currentArray);
12371
12373
  }
12372
12374
  }
@@ -12706,7 +12708,7 @@ var OpenFeedConnection = class {
12706
12708
  };
12707
12709
 
12708
12710
  // generated/version.ts
12709
- var version = "1.6.3";
12711
+ var version = "1.6.5";
12710
12712
 
12711
12713
  // src/utilities/client_version.ts
12712
12714
  var getClientVersion = async (clientId) => {
@@ -13102,7 +13104,9 @@ export {
13102
13104
  SnapshotRequestResult,
13103
13105
  SnapshotRequest_SnapshotRequestType,
13104
13106
  SubscriptionType,
13105
- SymbolType
13107
+ SymbolType,
13108
+ decodeMessages,
13109
+ encodeMessage
13106
13110
  };
13107
13111
  /*! Bundled license information:
13108
13112
 
@@ -2,3 +2,4 @@ export * from "./connection/client";
2
2
  export * from "./connection/interfaces";
3
3
  export * from "./connection/listeners";
4
4
  export * from "../generated/index";
5
+ export { encodeMessage, decodeMessages } from "./utilities/communication";
@@ -1,7 +1,7 @@
1
1
  import WebSocket from "isomorphic-ws";
2
2
  import { OptionalUndefined } from "@src/utilities/messages";
3
3
  import type { OpenfeedGatewayMessage, OpenfeedGatewayRequest } from "@gen/openfeed_api";
4
- export declare function encodeMessages(message: OpenfeedGatewayRequest): Uint8Array;
4
+ export declare function encodeMessage(message: OpenfeedGatewayRequest): Uint8Array;
5
5
  export declare function send(socket: WebSocket, message: OptionalUndefined<OpenfeedGatewayRequest>): void;
6
6
  export declare function decodeMessages(bytes: Uint8Array): Iterable<OpenfeedGatewayMessage>;
7
7
  export declare function receive(msgEvent: WebSocket.MessageEvent): OpenfeedGatewayMessage[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfeed/sdk-js",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "description": "JavaScript SDK for Barchart OpenFeed",
5
5
  "main": "dist/node.js",
6
6
  "browser": "dist/index.js",