mezon-js-protobuf 1.8.78 → 1.8.79
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/api/api.ts +386 -542
- package/dist/mezon-js-protobuf/api/api.d.ts +638 -1414
- package/dist/mezon-js-protobuf/rtapi/realtime.d.ts +622 -2006
- package/dist/mezon-js-protobuf/utils.d.ts +1 -0
- package/dist/mezon-js-protobuf.cjs.js +1627 -1810
- package/dist/mezon-js-protobuf.esm.mjs +1627 -1810
- package/package.json +1 -1
- package/rtapi/realtime.ts +20 -47
- package/utils.ts +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mezon-js-protobuf",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.79",
|
|
4
4
|
"description": "Websocket adapter adding protocol buffer support to the Mezon Javascript client.",
|
|
5
5
|
"main": "dist/mezon-js-protobuf.cjs.js",
|
|
6
6
|
"module": "dist/mezon-js-protobuf.esm.mjs",
|
package/rtapi/realtime.ts
CHANGED
|
@@ -90,7 +90,6 @@ import {
|
|
|
90
90
|
WebhookListRequest,
|
|
91
91
|
WebhookListResponse,
|
|
92
92
|
} from "../api/api";
|
|
93
|
-
import { Timestamp } from "../google/protobuf/timestamp";
|
|
94
93
|
import { BoolValue, Int32Value, StringValue } from "../google/protobuf/wrappers";
|
|
95
94
|
|
|
96
95
|
export const protobufPackage = "mezon.realtime";
|
|
@@ -672,13 +671,9 @@ export interface ChannelMessageAck {
|
|
|
672
671
|
/** Username of the message sender. */
|
|
673
672
|
username: string;
|
|
674
673
|
/** The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was created. */
|
|
675
|
-
|
|
676
|
-
| Date
|
|
677
|
-
| undefined;
|
|
674
|
+
create_time_seconds: number;
|
|
678
675
|
/** The UNIX time (for gRPC clients) or ISO string (for REST clients) when the message was last updated. */
|
|
679
|
-
|
|
680
|
-
| Date
|
|
681
|
-
| undefined;
|
|
676
|
+
update_time_seconds: number;
|
|
682
677
|
/** True if the message was persisted to the channel's history, false otherwise. */
|
|
683
678
|
persistent:
|
|
684
679
|
| boolean
|
|
@@ -5614,8 +5609,8 @@ function createBaseChannelMessageAck(): ChannelMessageAck {
|
|
|
5614
5609
|
message_id: "",
|
|
5615
5610
|
code: 0,
|
|
5616
5611
|
username: "",
|
|
5617
|
-
|
|
5618
|
-
|
|
5612
|
+
create_time_seconds: 0,
|
|
5613
|
+
update_time_seconds: 0,
|
|
5619
5614
|
persistent: undefined,
|
|
5620
5615
|
clan_logo: "",
|
|
5621
5616
|
category_name: "",
|
|
@@ -5636,11 +5631,11 @@ export const ChannelMessageAck = {
|
|
|
5636
5631
|
if (message.username !== "") {
|
|
5637
5632
|
writer.uint32(34).string(message.username);
|
|
5638
5633
|
}
|
|
5639
|
-
if (message.
|
|
5640
|
-
|
|
5634
|
+
if (message.create_time_seconds !== 0) {
|
|
5635
|
+
writer.uint32(40).uint32(message.create_time_seconds);
|
|
5641
5636
|
}
|
|
5642
|
-
if (message.
|
|
5643
|
-
|
|
5637
|
+
if (message.update_time_seconds !== 0) {
|
|
5638
|
+
writer.uint32(48).uint32(message.update_time_seconds);
|
|
5644
5639
|
}
|
|
5645
5640
|
if (message.persistent !== undefined) {
|
|
5646
5641
|
BoolValue.encode({ value: message.persistent! }, writer.uint32(58).fork()).ldelim();
|
|
@@ -5690,18 +5685,18 @@ export const ChannelMessageAck = {
|
|
|
5690
5685
|
message.username = reader.string();
|
|
5691
5686
|
continue;
|
|
5692
5687
|
case 5:
|
|
5693
|
-
if (tag !==
|
|
5688
|
+
if (tag !== 40) {
|
|
5694
5689
|
break;
|
|
5695
5690
|
}
|
|
5696
5691
|
|
|
5697
|
-
message.
|
|
5692
|
+
message.create_time_seconds = reader.uint32();
|
|
5698
5693
|
continue;
|
|
5699
5694
|
case 6:
|
|
5700
|
-
if (tag !==
|
|
5695
|
+
if (tag !== 48) {
|
|
5701
5696
|
break;
|
|
5702
5697
|
}
|
|
5703
5698
|
|
|
5704
|
-
message.
|
|
5699
|
+
message.update_time_seconds = reader.uint32();
|
|
5705
5700
|
continue;
|
|
5706
5701
|
case 7:
|
|
5707
5702
|
if (tag !== 58) {
|
|
@@ -5739,8 +5734,8 @@ export const ChannelMessageAck = {
|
|
|
5739
5734
|
message_id: isSet(object.message_id) ? globalThis.String(object.message_id) : "",
|
|
5740
5735
|
code: isSet(object.code) ? globalThis.Number(object.code) : 0,
|
|
5741
5736
|
username: isSet(object.username) ? globalThis.String(object.username) : "",
|
|
5742
|
-
|
|
5743
|
-
|
|
5737
|
+
create_time_seconds: isSet(object.create_time_seconds) ? globalThis.Number(object.create_time_seconds) : 0,
|
|
5738
|
+
update_time_seconds: isSet(object.update_time_seconds) ? globalThis.Number(object.update_time_seconds) : 0,
|
|
5744
5739
|
persistent: isSet(object.persistent) ? Boolean(object.persistent) : undefined,
|
|
5745
5740
|
clan_logo: isSet(object.clan_logo) ? globalThis.String(object.clan_logo) : "",
|
|
5746
5741
|
category_name: isSet(object.category_name) ? globalThis.String(object.category_name) : "",
|
|
@@ -5761,11 +5756,11 @@ export const ChannelMessageAck = {
|
|
|
5761
5756
|
if (message.username !== "") {
|
|
5762
5757
|
obj.username = message.username;
|
|
5763
5758
|
}
|
|
5764
|
-
if (message.
|
|
5765
|
-
obj.
|
|
5759
|
+
if (message.create_time_seconds !== 0) {
|
|
5760
|
+
obj.create_time_seconds = Math.round(message.create_time_seconds);
|
|
5766
5761
|
}
|
|
5767
|
-
if (message.
|
|
5768
|
-
obj.
|
|
5762
|
+
if (message.update_time_seconds !== 0) {
|
|
5763
|
+
obj.update_time_seconds = Math.round(message.update_time_seconds);
|
|
5769
5764
|
}
|
|
5770
5765
|
if (message.persistent !== undefined) {
|
|
5771
5766
|
obj.persistent = message.persistent;
|
|
@@ -5788,8 +5783,8 @@ export const ChannelMessageAck = {
|
|
|
5788
5783
|
message.message_id = object.message_id ?? "";
|
|
5789
5784
|
message.code = object.code ?? 0;
|
|
5790
5785
|
message.username = object.username ?? "";
|
|
5791
|
-
message.
|
|
5792
|
-
message.
|
|
5786
|
+
message.create_time_seconds = object.create_time_seconds ?? 0;
|
|
5787
|
+
message.update_time_seconds = object.update_time_seconds ?? 0;
|
|
5793
5788
|
message.persistent = object.persistent ?? undefined;
|
|
5794
5789
|
message.clan_logo = object.clan_logo ?? "";
|
|
5795
5790
|
message.category_name = object.category_name ?? "";
|
|
@@ -16665,28 +16660,6 @@ type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
|
16665
16660
|
export type Exact<P, I extends P> = P extends Builtin ? P
|
|
16666
16661
|
: P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
|
|
16667
16662
|
|
|
16668
|
-
function toTimestamp(date: Date): Timestamp {
|
|
16669
|
-
const seconds = Math.trunc(date.getTime() / 1_000);
|
|
16670
|
-
const nanos = (date.getTime() % 1_000) * 1_000_000;
|
|
16671
|
-
return { seconds, nanos };
|
|
16672
|
-
}
|
|
16673
|
-
|
|
16674
|
-
function fromTimestamp(t: Timestamp): Date {
|
|
16675
|
-
let millis = (t.seconds || 0) * 1_000;
|
|
16676
|
-
millis += (t.nanos || 0) / 1_000_000;
|
|
16677
|
-
return new globalThis.Date(millis);
|
|
16678
|
-
}
|
|
16679
|
-
|
|
16680
|
-
function fromJsonTimestamp(o: any): Date {
|
|
16681
|
-
if (o instanceof globalThis.Date) {
|
|
16682
|
-
return o;
|
|
16683
|
-
} else if (typeof o === "string") {
|
|
16684
|
-
return new globalThis.Date(o);
|
|
16685
|
-
} else {
|
|
16686
|
-
return fromTimestamp(Timestamp.fromJSON(o));
|
|
16687
|
-
}
|
|
16688
|
-
}
|
|
16689
|
-
|
|
16690
16663
|
function isObject(value: any): boolean {
|
|
16691
16664
|
return typeof value === "object" && value !== null;
|
|
16692
16665
|
}
|
package/utils.ts
CHANGED
|
@@ -31,6 +31,14 @@ export function decodeReactions(data: any) {
|
|
|
31
31
|
return noti;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
export function decodeChannelMessageHeader(data: any) {
|
|
35
|
+
const buffer: ArrayBuffer = data;
|
|
36
|
+
const uintBuffer: Uint8Array = new Uint8Array(buffer);
|
|
37
|
+
const noti = tsproto.ChannelMessageHeader.decode(uintBuffer);
|
|
38
|
+
|
|
39
|
+
return noti;
|
|
40
|
+
}
|
|
41
|
+
|
|
34
42
|
export function decodeNotificationFcm(data: any) {
|
|
35
43
|
const buffer: ArrayBuffer = data;
|
|
36
44
|
const uintBuffer: Uint8Array = new Uint8Array(buffer);
|