mezon-js 2.14.23 → 2.14.24

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.
@@ -32247,34 +32247,63 @@ function safeJSONParse(jsonStr) {
32247
32247
  }
32248
32248
  }
32249
32249
  function decodeMentions(data) {
32250
- const buffer = data;
32251
- const uintBuffer = new Uint8Array(buffer);
32252
- const mentions = MessageMentionList.decode(uintBuffer);
32253
- return mentions;
32250
+ try {
32251
+ const buffer = data;
32252
+ const uintBuffer = new Uint8Array(buffer);
32253
+ const mentions = MessageMentionList.decode(uintBuffer);
32254
+ return mentions;
32255
+ } catch (error) {
32256
+ console.error("Failed to decode mentions:", error);
32257
+ console.error(data, "data");
32258
+ return void 0;
32259
+ }
32254
32260
  }
32255
32261
  function decodeAttachments(data) {
32256
- const buffer = data;
32257
- const uintBuffer = new Uint8Array(buffer);
32258
- const attachments = MessageAttachmentList.decode(uintBuffer);
32259
- return attachments;
32262
+ try {
32263
+ const buffer = data;
32264
+ const uintBuffer = new Uint8Array(buffer);
32265
+ const attachments = MessageAttachmentList.decode(uintBuffer);
32266
+ return attachments;
32267
+ } catch (error) {
32268
+ console.error("Failed to decode attachments:", error);
32269
+ console.error(data, "data");
32270
+ return void 0;
32271
+ }
32260
32272
  }
32261
32273
  function decodeRefs(data) {
32262
- const buffer = data;
32263
- const uintBuffer = new Uint8Array(buffer);
32264
- const refs = MessageRefList.decode(uintBuffer);
32265
- return refs;
32274
+ try {
32275
+ const buffer = data;
32276
+ const uintBuffer = new Uint8Array(buffer);
32277
+ const refs = MessageRefList.decode(uintBuffer);
32278
+ return refs;
32279
+ } catch (error) {
32280
+ console.error("Failed to decode refs:", error);
32281
+ console.error(data, "data");
32282
+ return void 0;
32283
+ }
32266
32284
  }
32267
32285
  function decodeReactions(data) {
32268
- const buffer = data;
32269
- const uintBuffer = new Uint8Array(buffer);
32270
- const reactions = MessageReactionList.decode(uintBuffer);
32271
- return reactions;
32286
+ try {
32287
+ const buffer = data;
32288
+ const uintBuffer = new Uint8Array(buffer);
32289
+ const reactions = MessageReactionList.decode(uintBuffer);
32290
+ return reactions;
32291
+ } catch (error) {
32292
+ console.error("Failed to decode reactions:", error);
32293
+ console.error(data, "data");
32294
+ return void 0;
32295
+ }
32272
32296
  }
32273
32297
  function decodeNotificationFcm(data) {
32274
- const buffer = data;
32275
- const uintBuffer = new Uint8Array(buffer);
32276
- const noti = DirectFcmProto.decode(uintBuffer);
32277
- return noti;
32298
+ try {
32299
+ const buffer = data;
32300
+ const uintBuffer = new Uint8Array(buffer);
32301
+ const noti = DirectFcmProto.decode(uintBuffer);
32302
+ return noti;
32303
+ } catch (error) {
32304
+ console.error("Failed to decode notification FCM:", error);
32305
+ return void 0;
32306
+ }
32278
32307
  }
32279
32308
  function encodeAttachments(data) {
32280
32309
  const attachmentWriter = MessageAttachmentList.encode(
@@ -32216,34 +32216,63 @@ function safeJSONParse(jsonStr) {
32216
32216
  }
32217
32217
  }
32218
32218
  function decodeMentions(data) {
32219
- const buffer = data;
32220
- const uintBuffer = new Uint8Array(buffer);
32221
- const mentions = MessageMentionList.decode(uintBuffer);
32222
- return mentions;
32219
+ try {
32220
+ const buffer = data;
32221
+ const uintBuffer = new Uint8Array(buffer);
32222
+ const mentions = MessageMentionList.decode(uintBuffer);
32223
+ return mentions;
32224
+ } catch (error) {
32225
+ console.error("Failed to decode mentions:", error);
32226
+ console.error(data, "data");
32227
+ return void 0;
32228
+ }
32223
32229
  }
32224
32230
  function decodeAttachments(data) {
32225
- const buffer = data;
32226
- const uintBuffer = new Uint8Array(buffer);
32227
- const attachments = MessageAttachmentList.decode(uintBuffer);
32228
- return attachments;
32231
+ try {
32232
+ const buffer = data;
32233
+ const uintBuffer = new Uint8Array(buffer);
32234
+ const attachments = MessageAttachmentList.decode(uintBuffer);
32235
+ return attachments;
32236
+ } catch (error) {
32237
+ console.error("Failed to decode attachments:", error);
32238
+ console.error(data, "data");
32239
+ return void 0;
32240
+ }
32229
32241
  }
32230
32242
  function decodeRefs(data) {
32231
- const buffer = data;
32232
- const uintBuffer = new Uint8Array(buffer);
32233
- const refs = MessageRefList.decode(uintBuffer);
32234
- return refs;
32243
+ try {
32244
+ const buffer = data;
32245
+ const uintBuffer = new Uint8Array(buffer);
32246
+ const refs = MessageRefList.decode(uintBuffer);
32247
+ return refs;
32248
+ } catch (error) {
32249
+ console.error("Failed to decode refs:", error);
32250
+ console.error(data, "data");
32251
+ return void 0;
32252
+ }
32235
32253
  }
32236
32254
  function decodeReactions(data) {
32237
- const buffer = data;
32238
- const uintBuffer = new Uint8Array(buffer);
32239
- const reactions = MessageReactionList.decode(uintBuffer);
32240
- return reactions;
32255
+ try {
32256
+ const buffer = data;
32257
+ const uintBuffer = new Uint8Array(buffer);
32258
+ const reactions = MessageReactionList.decode(uintBuffer);
32259
+ return reactions;
32260
+ } catch (error) {
32261
+ console.error("Failed to decode reactions:", error);
32262
+ console.error(data, "data");
32263
+ return void 0;
32264
+ }
32241
32265
  }
32242
32266
  function decodeNotificationFcm(data) {
32243
- const buffer = data;
32244
- const uintBuffer = new Uint8Array(buffer);
32245
- const noti = DirectFcmProto.decode(uintBuffer);
32246
- return noti;
32267
+ try {
32268
+ const buffer = data;
32269
+ const uintBuffer = new Uint8Array(buffer);
32270
+ const noti = DirectFcmProto.decode(uintBuffer);
32271
+ return noti;
32272
+ } catch (error) {
32273
+ console.error("Failed to decode notification FCM:", error);
32274
+ return void 0;
32275
+ }
32247
32276
  }
32248
32277
  function encodeAttachments(data) {
32249
32278
  const attachmentWriter = MessageAttachmentList.encode(
package/dist/utils.d.ts CHANGED
@@ -3,9 +3,9 @@ export declare function buildFetchOptions(method: string, options: any, bodyJson
3
3
  export declare function b64EncodeUnicode(str: string): string;
4
4
  export declare function b64DecodeUnicode(str: string): string;
5
5
  export declare function safeJSONParse(jsonStr: string): any;
6
- export declare function decodeMentions(data: any): tsproto.MessageMentionList;
7
- export declare function decodeAttachments(data: any): tsproto.MessageAttachmentList;
8
- export declare function decodeRefs(data: any): tsproto.MessageRefList;
9
- export declare function decodeReactions(data: any): tsproto.MessageReactionList;
10
- export declare function decodeNotificationFcm(data: any): tsproto.DirectFcmProto;
6
+ export declare function decodeMentions(data: any): tsproto.MessageMentionList | undefined;
7
+ export declare function decodeAttachments(data: any): tsproto.MessageAttachmentList | undefined;
8
+ export declare function decodeRefs(data: any): tsproto.MessageRefList | undefined;
9
+ export declare function decodeReactions(data: any): tsproto.MessageReactionList | undefined;
10
+ export declare function decodeNotificationFcm(data: any): tsproto.DirectFcmProto | undefined;
11
11
  export declare function encodeAttachments(data: tsproto.MessageAttachmentList): Uint8Array;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.14.23",
3
+ "version": "2.14.24",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/utils.ts CHANGED
@@ -56,42 +56,68 @@ export function safeJSONParse(jsonStr: string) {
56
56
  }
57
57
 
58
58
  export function decodeMentions(data: any) {
59
- const buffer: ArrayBuffer = data;
60
- const uintBuffer: Uint8Array = new Uint8Array(buffer);
61
- const mentions = tsproto.MessageMentionList.decode(uintBuffer);
62
-
63
- return mentions;
59
+ try {
60
+ const buffer: ArrayBuffer = data;
61
+ const uintBuffer: Uint8Array = new Uint8Array(buffer);
62
+ const mentions = tsproto.MessageMentionList.decode(uintBuffer);
63
+ return mentions;
64
+ } catch (error) {
65
+ console.error('Failed to decode mentions:', error);
66
+ console.error(data, 'data');
67
+ return undefined;
68
+ }
64
69
  }
65
70
 
66
71
  export function decodeAttachments(data: any) {
67
- const buffer: ArrayBuffer = data;
68
- const uintBuffer: Uint8Array = new Uint8Array(buffer);
69
- const attachments = tsproto.MessageAttachmentList.decode(uintBuffer);
70
-
71
- return attachments;
72
+ try {
73
+ const buffer: ArrayBuffer = data;
74
+ const uintBuffer: Uint8Array = new Uint8Array(buffer);
75
+ const attachments = tsproto.MessageAttachmentList.decode(uintBuffer);
76
+ return attachments;
77
+ } catch (error) {
78
+ console.error('Failed to decode attachments:', error);
79
+ console.error(data, 'data');
80
+
81
+ return undefined;
82
+ }
72
83
  }
73
84
 
74
85
  export function decodeRefs(data: any) {
75
- const buffer: ArrayBuffer = data;
76
- const uintBuffer: Uint8Array = new Uint8Array(buffer);
77
- const refs = tsproto.MessageRefList.decode(uintBuffer);
78
-
79
- return refs;
86
+ try {
87
+ const buffer: ArrayBuffer = data;
88
+ const uintBuffer: Uint8Array = new Uint8Array(buffer);
89
+ const refs = tsproto.MessageRefList.decode(uintBuffer);
90
+ return refs;
91
+ } catch (error) {
92
+ console.error('Failed to decode refs:', error);
93
+ console.error(data, 'data');
94
+ return undefined;
95
+ }
80
96
  }
81
97
 
82
98
  export function decodeReactions(data: any) {
83
- const buffer: ArrayBuffer = data;
84
- const uintBuffer: Uint8Array = new Uint8Array(buffer);
85
- const reactions = tsproto.MessageReactionList.decode(uintBuffer);
86
- return reactions;
99
+ try {
100
+ const buffer: ArrayBuffer = data;
101
+ const uintBuffer: Uint8Array = new Uint8Array(buffer);
102
+ const reactions = tsproto.MessageReactionList.decode(uintBuffer);
103
+ return reactions;
104
+ } catch (error) {
105
+ console.error('Failed to decode reactions:', error);
106
+ console.error(data, 'data');
107
+ return undefined;
108
+ }
87
109
  }
88
110
 
89
111
  export function decodeNotificationFcm(data: any) {
90
- const buffer: ArrayBuffer = data;
91
- const uintBuffer: Uint8Array = new Uint8Array(buffer);
92
- const noti = tsproto.DirectFcmProto.decode(uintBuffer);
93
-
94
- return noti;
112
+ try {
113
+ const buffer: ArrayBuffer = data;
114
+ const uintBuffer: Uint8Array = new Uint8Array(buffer);
115
+ const noti = tsproto.DirectFcmProto.decode(uintBuffer);
116
+ return noti;
117
+ } catch (error) {
118
+ console.error('Failed to decode notification FCM:', error);
119
+ return undefined;
120
+ }
95
121
  }
96
122
 
97
123
  export function encodeAttachments(data: tsproto.MessageAttachmentList) {