@openfeed/sdk-js 1.6.2 → 1.6.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.
@@ -1 +1 @@
1
- export declare const version = "1.6.2";
1
+ export declare const version = "1.6.3";
package/dist/index.js CHANGED
@@ -8666,22 +8666,25 @@ class CorrelationId {
8666
8666
  };
8667
8667
  }
8668
8668
  const toT = (obj) => obj;
8669
- const send = (socket, message) => {
8670
- socket.send(OpenfeedGatewayRequestEncode.encode(toT(message)).finish());
8671
- };
8669
+ function encodeMessages(message) {
8670
+ return OpenfeedGatewayRequestEncode.encode(message).finish();
8671
+ }
8672
+ function send(socket, message) {
8673
+ socket.send(encodeMessages(toT(message)));
8674
+ }
8672
8675
  const getShort = (a, b) => a << 8 | b << 0;
8673
- const receive = (msgEvent) => {
8674
- const array = new Uint8Array(msgEvent.data);
8676
+ function* decodeMessages(bytes) {
8675
8677
  let currentIndex = 0;
8676
- const res = [];
8677
- while (getShort(array[currentIndex], array[currentIndex + 1])) {
8678
- const shortVal = getShort(array[currentIndex], array[currentIndex + 1]) + 2;
8679
- const currentArray = array.subarray(currentIndex + 2, currentIndex + shortVal);
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);
8680
8681
  currentIndex += shortVal;
8681
- res.push(OpenfeedGatewayMessageDecode.decode(currentArray));
8682
+ yield OpenfeedGatewayMessageDecode.decode(currentArray);
8682
8683
  }
8683
- return res;
8684
- };
8684
+ }
8685
+ function receive(msgEvent) {
8686
+ return [...decodeMessages(new Uint8Array(msgEvent.data))];
8687
+ }
8685
8688
  const TIME = {
8686
8689
  RECONNECT: 5e3,
8687
8690
  RECONNECT_RANDOMIZE: 5e3,
@@ -9000,7 +9003,7 @@ class OpenFeedConnection {
9000
9003
  whenDisconnected = () => this.whenDisconnectedSource.whenCompleted;
9001
9004
  dispose = () => this.disconnect(new ConnectionDisposedError("Disposed"));
9002
9005
  }
9003
- const version = "1.6.2";
9006
+ const version = "1.6.3";
9004
9007
  const getClientVersion = async (clientId) => {
9005
9008
  let platformDescription;
9006
9009
  if (typeof window !== "undefined") {
package/dist/node.js CHANGED
@@ -12354,22 +12354,25 @@ var CorrelationId = class {
12354
12354
  var toT = (obj) => obj;
12355
12355
 
12356
12356
  // src/utilities/communication.ts
12357
- var send = (socket, message) => {
12358
- socket.send(OpenfeedGatewayRequestEncode.encode(toT(message)).finish());
12359
- };
12357
+ function encodeMessages(message) {
12358
+ return OpenfeedGatewayRequestEncode.encode(message).finish();
12359
+ }
12360
+ function send(socket, message) {
12361
+ socket.send(encodeMessages(toT(message)));
12362
+ }
12360
12363
  var getShort = (a, b) => a << 8 | b << 0;
12361
- var receive = (msgEvent) => {
12362
- const array = new Uint8Array(msgEvent.data);
12364
+ function* decodeMessages(bytes) {
12363
12365
  let currentIndex = 0;
12364
- const res = [];
12365
- while (getShort(array[currentIndex], array[currentIndex + 1])) {
12366
- const shortVal = getShort(array[currentIndex], array[currentIndex + 1]) + 2;
12367
- const currentArray = array.subarray(currentIndex + 2, currentIndex + shortVal);
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);
12368
12369
  currentIndex += shortVal;
12369
- res.push(OpenfeedGatewayMessageDecode.decode(currentArray));
12370
+ yield OpenfeedGatewayMessageDecode.decode(currentArray);
12370
12371
  }
12371
- return res;
12372
- };
12372
+ }
12373
+ function receive(msgEvent) {
12374
+ return [...decodeMessages(new Uint8Array(msgEvent.data))];
12375
+ }
12373
12376
 
12374
12377
  // src/utilities/constants.ts
12375
12378
  var TIME = {
@@ -12703,7 +12706,7 @@ var OpenFeedConnection = class {
12703
12706
  };
12704
12707
 
12705
12708
  // generated/version.ts
12706
- var version = "1.6.2";
12709
+ var version = "1.6.3";
12707
12710
 
12708
12711
  // src/utilities/client_version.ts
12709
12712
  var getClientVersion = async (clientId) => {
@@ -1,5 +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 const send: (socket: WebSocket, message: OptionalUndefined<OpenfeedGatewayRequest>) => void;
5
- export declare const receive: (msgEvent: WebSocket.MessageEvent) => OpenfeedGatewayMessage[];
4
+ export declare function encodeMessages(message: OpenfeedGatewayRequest): Uint8Array;
5
+ export declare function send(socket: WebSocket, message: OptionalUndefined<OpenfeedGatewayRequest>): void;
6
+ export declare function decodeMessages(bytes: Uint8Array): Iterable<OpenfeedGatewayMessage>;
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.2",
3
+ "version": "1.6.3",
4
4
  "description": "JavaScript SDK for Barchart OpenFeed",
5
5
  "main": "dist/node.js",
6
6
  "browser": "dist/index.js",