mezon-js 2.14.13 → 2.14.14

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.gen.ts CHANGED
@@ -1994,7 +1994,7 @@ export interface ApiNotification {
1994
1994
  //Category code for this notification.
1995
1995
  code?: number;
1996
1996
  //Content of the notification in JSON.
1997
- content?: string;
1997
+ content?: tsproto.DirectFcmProto;
1998
1998
  //The UNIX time (for gRPC clients) or ISO string (for REST clients) when the notification was created.
1999
1999
  create_time?: string;
2000
2000
  //ID of the Notification.
package/client.ts CHANGED
@@ -173,7 +173,7 @@ import {
173
173
 
174
174
  import { Session } from "./session";
175
175
  import { DefaultSocket, Socket } from "./socket";
176
- import { decodeAttachments, decodeMentions, decodeReactions, decodeRefs, safeJSONParse } from "./utils";
176
+ import { decodeAttachments, decodeMentions, decodeNotificationFcm, decodeReactions, decodeRefs, safeJSONParse } from "./utils";
177
177
  import { WebSocketAdapter, WebSocketAdapterText } from "./web_socket_adapter";
178
178
 
179
179
  const DEFAULT_HOST = "127.0.0.1";
@@ -1919,7 +1919,7 @@ export class Client {
1919
1919
  result.notifications!.push({
1920
1920
  id: n.id,
1921
1921
  subject: n.subject,
1922
- content: n.content ? safeJSONParse(n.content) : undefined,
1922
+ content: n.content ? decodeNotificationFcm(n.content) : undefined,
1923
1923
  code: n.code ? Number(n.code) : 0,
1924
1924
  sender_id: n.sender_id,
1925
1925
  create_time: n.create_time,
package/dist/api.gen.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import * as tsproto from "./api/api";
1
2
  import { ApiUpdateChannelDescRequest } from "./client";
2
3
  /** A single user-role pair. */
3
4
  export interface ChannelUserListChannelUser {
@@ -1134,7 +1135,7 @@ export interface ApiNotification {
1134
1135
  channel_type?: number;
1135
1136
  clan_id?: string;
1136
1137
  code?: number;
1137
- content?: string;
1138
+ content?: tsproto.DirectFcmProto;
1138
1139
  create_time?: string;
1139
1140
  id?: string;
1140
1141
  persistent?: boolean;
@@ -38677,7 +38677,7 @@ var _DefaultSocket = class _DefaultSocket {
38677
38677
  if (!message.cid) {
38678
38678
  if (message.notifications) {
38679
38679
  message.notifications.notifications.forEach((n) => {
38680
- n.content = n.content ? safeJSONParse(n.content) : void 0;
38680
+ n.content = n.content ? decodeNotificationFcm(n.content) : void 0;
38681
38681
  this.onnotification(n);
38682
38682
  });
38683
38683
  } else if (message.voice_started_event) {
@@ -40768,7 +40768,7 @@ var Client = class {
40768
40768
  result.notifications.push({
40769
40769
  id: n.id,
40770
40770
  subject: n.subject,
40771
- content: n.content ? safeJSONParse(n.content) : void 0,
40771
+ content: n.content ? decodeNotificationFcm(n.content) : void 0,
40772
40772
  code: n.code ? Number(n.code) : 0,
40773
40773
  sender_id: n.sender_id,
40774
40774
  create_time: n.create_time,
@@ -38647,7 +38647,7 @@ var _DefaultSocket = class _DefaultSocket {
38647
38647
  if (!message.cid) {
38648
38648
  if (message.notifications) {
38649
38649
  message.notifications.notifications.forEach((n) => {
38650
- n.content = n.content ? safeJSONParse(n.content) : void 0;
38650
+ n.content = n.content ? decodeNotificationFcm(n.content) : void 0;
38651
38651
  this.onnotification(n);
38652
38652
  });
38653
38653
  } else if (message.voice_started_event) {
@@ -40738,7 +40738,7 @@ var Client = class {
40738
40738
  result.notifications.push({
40739
40739
  id: n.id,
40740
40740
  subject: n.subject,
40741
- content: n.content ? safeJSONParse(n.content) : void 0,
40741
+ content: n.content ? decodeNotificationFcm(n.content) : void 0,
40742
40742
  code: n.code ? Number(n.code) : 0,
40743
40743
  sender_id: n.sender_id,
40744
40744
  create_time: n.create_time,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.14.13",
3
+ "version": "2.14.14",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -65,7 +65,7 @@ import {
65
65
  } from "./api.gen";
66
66
  import { Session } from "./session";
67
67
  import { WebSocketAdapter, WebSocketAdapterText } from "./web_socket_adapter";
68
- import { safeJSONParse } from "./utils";
68
+ import { decodeNotificationFcm, safeJSONParse } from "./utils";
69
69
 
70
70
  /** Stores function references for resolve/reject with a DOM Promise. */
71
71
  interface PromiseExecutor {
@@ -1952,7 +1952,7 @@ export class DefaultSocket implements Socket {
1952
1952
  if (!message.cid) {
1953
1953
  if (message.notifications) {
1954
1954
  message.notifications.notifications.forEach((n: ApiNotification) => {
1955
- n.content = n.content ? safeJSONParse(n.content) : undefined;
1955
+ n.content = n.content ? decodeNotificationFcm(n.content) : undefined;
1956
1956
  this.onnotification(n);
1957
1957
  });
1958
1958
  } else if (message.voice_started_event) {