mezon-js 2.10.78 → 2.10.80
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 +2 -0
- package/dist/api.gen.d.ts +1 -0
- package/dist/mezon-js.cjs.js +7 -0
- package/dist/mezon-js.esm.mjs +7 -0
- package/dist/socket.d.ts +25 -4
- package/package.json +1 -1
- package/socket.ts +38 -3
package/api.gen.ts
CHANGED
package/dist/api.gen.d.ts
CHANGED
package/dist/mezon-js.cjs.js
CHANGED
@@ -7211,6 +7211,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7211
7211
|
this.onroleevent(message.role_event);
|
7212
7212
|
} else if (message.event_emoji) {
|
7213
7213
|
this.oneventemoji(message.event_emoji);
|
7214
|
+
} else if (message.noti_user_channel) {
|
7215
|
+
this.oneventnotiuserchannel(message.noti_user_channel);
|
7214
7216
|
} else if (message.webhook_event) {
|
7215
7217
|
this.oneventwebhook(message.webhook_event);
|
7216
7218
|
} else if (message.channel_deleted_event) {
|
@@ -7552,6 +7554,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7552
7554
|
console.log(eventEmoji);
|
7553
7555
|
}
|
7554
7556
|
}
|
7557
|
+
oneventnotiuserchannel(notiUserChannel) {
|
7558
|
+
if (this.verbose && window && window.console) {
|
7559
|
+
console.log(notiUserChannel);
|
7560
|
+
}
|
7561
|
+
}
|
7555
7562
|
oneventwebhook(webhook_event) {
|
7556
7563
|
if (this.verbose && window && window.console) {
|
7557
7564
|
console.log(webhook_event);
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -7177,6 +7177,8 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7177
7177
|
this.onroleevent(message.role_event);
|
7178
7178
|
} else if (message.event_emoji) {
|
7179
7179
|
this.oneventemoji(message.event_emoji);
|
7180
|
+
} else if (message.noti_user_channel) {
|
7181
|
+
this.oneventnotiuserchannel(message.noti_user_channel);
|
7180
7182
|
} else if (message.webhook_event) {
|
7181
7183
|
this.oneventwebhook(message.webhook_event);
|
7182
7184
|
} else if (message.channel_deleted_event) {
|
@@ -7518,6 +7520,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7518
7520
|
console.log(eventEmoji);
|
7519
7521
|
}
|
7520
7522
|
}
|
7523
|
+
oneventnotiuserchannel(notiUserChannel) {
|
7524
|
+
if (this.verbose && window && window.console) {
|
7525
|
+
console.log(notiUserChannel);
|
7526
|
+
}
|
7527
|
+
}
|
7521
7528
|
oneventwebhook(webhook_event) {
|
7522
7529
|
if (this.verbose && window && window.console) {
|
7523
7530
|
console.log(webhook_event);
|
package/dist/socket.d.ts
CHANGED
@@ -13,9 +13,9 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent, ApiUserActivity, ApiWebhook } from "./api.gen";
|
16
|
+
import { ApiChannelDescription, ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotificationUserChannel, ApiPermissionUpdate, ApiRole, ApiRpc, ApiTokenSentEvent, ApiUserActivity, ApiWebhook } from "./api.gen";
|
17
17
|
import { Session } from "./session";
|
18
|
-
import { ChannelMessage
|
18
|
+
import { ChannelMessage } from "./client";
|
19
19
|
import { WebSocketAdapter } from "./web_socket_adapter";
|
20
20
|
/** An object which represents a connected user in the server. */
|
21
21
|
export interface Presence {
|
@@ -32,6 +32,25 @@ export interface Presence {
|
|
32
32
|
is_mobile: boolean;
|
33
33
|
metadata: string;
|
34
34
|
}
|
35
|
+
export interface NotificationInfo {
|
36
|
+
/** Category code for this notification. */
|
37
|
+
code?: number;
|
38
|
+
/** Content of the notification in JSON. */
|
39
|
+
content?: {};
|
40
|
+
/** The UNIX time when the notification was created. */
|
41
|
+
create_time?: string;
|
42
|
+
/** ID of the Notification. */
|
43
|
+
id?: string;
|
44
|
+
/** True if this notification was persisted to the database. */
|
45
|
+
persistent?: boolean;
|
46
|
+
/** ID of the sender, if a user. Otherwise 'null'. */
|
47
|
+
sender_id?: string;
|
48
|
+
/** Subject of the notification. */
|
49
|
+
subject?: string;
|
50
|
+
channel_id?: string;
|
51
|
+
clan_id?: string;
|
52
|
+
channel?: ApiChannelDescription;
|
53
|
+
}
|
35
54
|
/** A response from a channel join operation. */
|
36
55
|
export interface Channel {
|
37
56
|
/** The server-assigned channel id. */
|
@@ -719,7 +738,7 @@ export interface Socket {
|
|
719
738
|
/** Handle error events received from the socket. */
|
720
739
|
onerror: (evt: Event) => void;
|
721
740
|
/** Receive notifications from the socket. */
|
722
|
-
onnotification: (notification:
|
741
|
+
onnotification: (notification: NotificationInfo) => void;
|
723
742
|
/** Receive status presence updates. */
|
724
743
|
onstatuspresence: (statusPresence: StatusPresenceEvent) => void;
|
725
744
|
/** Receive stream presence updates. */
|
@@ -777,6 +796,7 @@ export interface Socket {
|
|
777
796
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
778
797
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
779
798
|
oneventemoji: (event_emoji: EventEmoji) => void;
|
799
|
+
oneventnotiuserchannel: (noti_user_channel: ApiNotificationUserChannel) => void;
|
780
800
|
oneventwebhook: (webhook_event: ApiWebhook) => void;
|
781
801
|
onroleassign: (role_assign_event: RoleAssignedEvent) => void;
|
782
802
|
onstreamingchannelstarted: (streaming_started_event: StreamingStartedEvent) => void;
|
@@ -832,7 +852,7 @@ export declare class DefaultSocket implements Socket {
|
|
832
852
|
onuserchannelremoved(user: UserChannelRemovedEvent): void;
|
833
853
|
onremovefriend(user: RemoveFriend): void;
|
834
854
|
onuserclanremoved(user: UserClanRemovedEvent): void;
|
835
|
-
onnotification(notification:
|
855
|
+
onnotification(notification: NotificationInfo): void;
|
836
856
|
onstatuspresence(statusPresence: StatusPresenceEvent): void;
|
837
857
|
onpinmessage(pin: LastPinMessageEvent): void;
|
838
858
|
onvoiceended(voice: VoiceEndedEvent): void;
|
@@ -842,6 +862,7 @@ export declare class DefaultSocket implements Socket {
|
|
842
862
|
onchannelcreated(channelCreated: ChannelCreatedEvent): void;
|
843
863
|
onroleevent(roleEvent: RoleEvent): void;
|
844
864
|
oneventemoji(eventEmoji: EventEmoji): void;
|
865
|
+
oneventnotiuserchannel(notiUserChannel: ApiNotificationUserChannel): void;
|
845
866
|
oneventwebhook(webhook_event: ApiWebhook): void;
|
846
867
|
onchanneldeleted(channelDeleted: ChannelDeletedEvent): void;
|
847
868
|
onclandeleted(clanDeleted: ClanDeletedEvent): void;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -15,6 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import {
|
18
|
+
ApiChannelDescription,
|
18
19
|
ApiChannelMessageHeader,
|
19
20
|
ApiCreateEventRequest,
|
20
21
|
ApiGiveCoffeeEvent,
|
@@ -23,6 +24,7 @@ import {
|
|
23
24
|
ApiMessageReaction,
|
24
25
|
ApiMessageRef,
|
25
26
|
ApiNotification,
|
27
|
+
ApiNotificationUserChannel,
|
26
28
|
ApiPermissionUpdate,
|
27
29
|
ApiRole,
|
28
30
|
ApiRpc,
|
@@ -31,7 +33,7 @@ import {
|
|
31
33
|
ApiWebhook,
|
32
34
|
} from "./api.gen";
|
33
35
|
import { Session } from "./session";
|
34
|
-
import { ChannelMessage
|
36
|
+
import { ChannelMessage } from "./client";
|
35
37
|
import { WebSocketAdapter, WebSocketAdapterText } from "./web_socket_adapter";
|
36
38
|
import { safeJSONParse } from "./utils";
|
37
39
|
|
@@ -58,6 +60,29 @@ export interface Presence {
|
|
58
60
|
metadata: string;
|
59
61
|
}
|
60
62
|
|
63
|
+
export interface NotificationInfo {
|
64
|
+
/** Category code for this notification. */
|
65
|
+
code?: number;
|
66
|
+
/** Content of the notification in JSON. */
|
67
|
+
content?: {};
|
68
|
+
/** The UNIX time when the notification was created. */
|
69
|
+
create_time?: string;
|
70
|
+
/** ID of the Notification. */
|
71
|
+
id?: string;
|
72
|
+
/** True if this notification was persisted to the database. */
|
73
|
+
persistent?: boolean;
|
74
|
+
/** ID of the sender, if a user. Otherwise 'null'. */
|
75
|
+
sender_id?: string;
|
76
|
+
/** Subject of the notification. */
|
77
|
+
subject?: string;
|
78
|
+
//
|
79
|
+
channel_id?: string;
|
80
|
+
//
|
81
|
+
clan_id?: string;
|
82
|
+
//
|
83
|
+
channel?: ApiChannelDescription;
|
84
|
+
}
|
85
|
+
|
61
86
|
/** A response from a channel join operation. */
|
62
87
|
export interface Channel {
|
63
88
|
/** The server-assigned channel id. */
|
@@ -1160,7 +1185,7 @@ export interface Socket {
|
|
1160
1185
|
onerror: (evt: Event) => void;
|
1161
1186
|
|
1162
1187
|
/** Receive notifications from the socket. */
|
1163
|
-
onnotification: (notification:
|
1188
|
+
onnotification: (notification: NotificationInfo) => void;
|
1164
1189
|
|
1165
1190
|
/** Receive status presence updates. */
|
1166
1191
|
onstatuspresence: (statusPresence: StatusPresenceEvent) => void;
|
@@ -1271,6 +1296,8 @@ export interface Socket {
|
|
1271
1296
|
|
1272
1297
|
oneventemoji: (event_emoji: EventEmoji) => void;
|
1273
1298
|
|
1299
|
+
oneventnotiuserchannel: (noti_user_channel: ApiNotificationUserChannel) => void;
|
1300
|
+
|
1274
1301
|
oneventwebhook: (webhook_event: ApiWebhook) => void;
|
1275
1302
|
|
1276
1303
|
onroleassign: (role_assign_event: RoleAssignedEvent) => void;
|
@@ -1404,6 +1431,8 @@ export class DefaultSocket implements Socket {
|
|
1404
1431
|
this.onroleevent(message.role_event);
|
1405
1432
|
} else if (message.event_emoji) {
|
1406
1433
|
this.oneventemoji(message.event_emoji);
|
1434
|
+
} else if (message.noti_user_channel) {
|
1435
|
+
this.oneventnotiuserchannel(message.noti_user_channel);
|
1407
1436
|
} else if (message.webhook_event) {
|
1408
1437
|
this.oneventwebhook(message.webhook_event);
|
1409
1438
|
} else if (message.channel_deleted_event) {
|
@@ -1716,7 +1745,7 @@ export class DefaultSocket implements Socket {
|
|
1716
1745
|
}
|
1717
1746
|
}
|
1718
1747
|
|
1719
|
-
onnotification(notification:
|
1748
|
+
onnotification(notification: NotificationInfo) {
|
1720
1749
|
if (this.verbose && window && window.console) {
|
1721
1750
|
console.log(notification);
|
1722
1751
|
}
|
@@ -1776,6 +1805,12 @@ export class DefaultSocket implements Socket {
|
|
1776
1805
|
}
|
1777
1806
|
}
|
1778
1807
|
|
1808
|
+
oneventnotiuserchannel(notiUserChannel: ApiNotificationUserChannel) {
|
1809
|
+
if (this.verbose && window && window.console) {
|
1810
|
+
console.log(notiUserChannel);
|
1811
|
+
}
|
1812
|
+
}
|
1813
|
+
|
1779
1814
|
oneventwebhook(webhook_event: ApiWebhook) {
|
1780
1815
|
if (this.verbose && window && window.console) {
|
1781
1816
|
console.log(webhook_event);
|