@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.
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.js +16 -13
- package/dist/node.js +16 -13
- package/dist/src/utilities/communication.d.ts +4 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.6.
|
|
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
|
-
|
|
8670
|
-
|
|
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
|
-
|
|
8674
|
-
const array = new Uint8Array(msgEvent.data);
|
|
8676
|
+
function* decodeMessages(bytes) {
|
|
8675
8677
|
let currentIndex = 0;
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
const
|
|
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
|
-
|
|
8682
|
+
yield OpenfeedGatewayMessageDecode.decode(currentArray);
|
|
8682
8683
|
}
|
|
8683
|
-
|
|
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.
|
|
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
|
-
|
|
12358
|
-
|
|
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
|
-
|
|
12362
|
-
const array = new Uint8Array(msgEvent.data);
|
|
12364
|
+
function* decodeMessages(bytes) {
|
|
12363
12365
|
let currentIndex = 0;
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
const
|
|
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
|
-
|
|
12370
|
+
yield OpenfeedGatewayMessageDecode.decode(currentArray);
|
|
12370
12371
|
}
|
|
12371
|
-
|
|
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.
|
|
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
|
|
5
|
-
export declare
|
|
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[];
|