mezon-js-protobuf 1.8.77 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js-protobuf",
3
- "version": "1.8.77",
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
- create_time:
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
- update_time:
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
- create_time: undefined,
5618
- update_time: undefined,
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.create_time !== undefined) {
5640
- Timestamp.encode(toTimestamp(message.create_time), writer.uint32(42).fork()).ldelim();
5634
+ if (message.create_time_seconds !== 0) {
5635
+ writer.uint32(40).uint32(message.create_time_seconds);
5641
5636
  }
5642
- if (message.update_time !== undefined) {
5643
- Timestamp.encode(toTimestamp(message.update_time), writer.uint32(50).fork()).ldelim();
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 !== 42) {
5688
+ if (tag !== 40) {
5694
5689
  break;
5695
5690
  }
5696
5691
 
5697
- message.create_time = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
5692
+ message.create_time_seconds = reader.uint32();
5698
5693
  continue;
5699
5694
  case 6:
5700
- if (tag !== 50) {
5695
+ if (tag !== 48) {
5701
5696
  break;
5702
5697
  }
5703
5698
 
5704
- message.update_time = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
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
- create_time: isSet(object.create_time) ? fromJsonTimestamp(object.create_time) : undefined,
5743
- update_time: isSet(object.update_time) ? fromJsonTimestamp(object.update_time) : undefined,
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.create_time !== undefined) {
5765
- obj.create_time = message.create_time.toISOString();
5759
+ if (message.create_time_seconds !== 0) {
5760
+ obj.create_time_seconds = Math.round(message.create_time_seconds);
5766
5761
  }
5767
- if (message.update_time !== undefined) {
5768
- obj.update_time = message.update_time.toISOString();
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.create_time = object.create_time ?? undefined;
5792
- message.update_time = object.update_time ?? undefined;
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
@@ -5,7 +5,7 @@ export function decodeMentions(data: any) {
5
5
  const uintBuffer: Uint8Array = new Uint8Array(buffer);
6
6
  const mentions = tsproto.MessageMentionList.decode(uintBuffer);
7
7
 
8
- return mentions
8
+ return mentions;
9
9
  }
10
10
 
11
11
  export function decodeAttachments(data: any) {
@@ -13,7 +13,7 @@ export function decodeAttachments(data: any) {
13
13
  const uintBuffer: Uint8Array = new Uint8Array(buffer);
14
14
  const attachments = tsproto.MessageAttachmentList.decode(uintBuffer);
15
15
 
16
- return attachments
16
+ return attachments;
17
17
  }
18
18
 
19
19
  export function decodeRefs(data: any) {
@@ -21,7 +21,22 @@ export function decodeRefs(data: any) {
21
21
  const uintBuffer: Uint8Array = new Uint8Array(buffer);
22
22
  const refs = tsproto.MessageRefList.decode(uintBuffer);
23
23
 
24
- return refs
24
+ return refs;
25
+ }
26
+
27
+ export function decodeReactions(data: any) {
28
+ const buffer: ArrayBuffer = data;
29
+ const uintBuffer: Uint8Array = new Uint8Array(buffer);
30
+ const noti = tsproto.MessageReactionList.decode(uintBuffer);
31
+ return noti;
32
+ }
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;
25
40
  }
26
41
 
27
42
  export function decodeNotificationFcm(data: any) {
@@ -29,5 +44,5 @@ export function decodeNotificationFcm(data: any) {
29
44
  const uintBuffer: Uint8Array = new Uint8Array(buffer);
30
45
  const noti = tsproto.DirectFcmProto.decode(uintBuffer);
31
46
 
32
- return noti
47
+ return noti;
33
48
  }