mezon-js 2.10.78 → 2.10.79
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/socket.d.ts +23 -4
- package/package.json +1 -1
- package/socket.ts +27 -3
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, 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. */
|
@@ -832,7 +851,7 @@ export declare class DefaultSocket implements Socket {
|
|
832
851
|
onuserchannelremoved(user: UserChannelRemovedEvent): void;
|
833
852
|
onremovefriend(user: RemoveFriend): void;
|
834
853
|
onuserclanremoved(user: UserClanRemovedEvent): void;
|
835
|
-
onnotification(notification:
|
854
|
+
onnotification(notification: NotificationInfo): void;
|
836
855
|
onstatuspresence(statusPresence: StatusPresenceEvent): void;
|
837
856
|
onpinmessage(pin: LastPinMessageEvent): void;
|
838
857
|
onvoiceended(voice: VoiceEndedEvent): 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,
|
@@ -31,7 +32,7 @@ import {
|
|
31
32
|
ApiWebhook,
|
32
33
|
} from "./api.gen";
|
33
34
|
import { Session } from "./session";
|
34
|
-
import { ChannelMessage
|
35
|
+
import { ChannelMessage } from "./client";
|
35
36
|
import { WebSocketAdapter, WebSocketAdapterText } from "./web_socket_adapter";
|
36
37
|
import { safeJSONParse } from "./utils";
|
37
38
|
|
@@ -58,6 +59,29 @@ export interface Presence {
|
|
58
59
|
metadata: string;
|
59
60
|
}
|
60
61
|
|
62
|
+
export interface NotificationInfo {
|
63
|
+
/** Category code for this notification. */
|
64
|
+
code?: number;
|
65
|
+
/** Content of the notification in JSON. */
|
66
|
+
content?: {};
|
67
|
+
/** The UNIX time when the notification was created. */
|
68
|
+
create_time?: string;
|
69
|
+
/** ID of the Notification. */
|
70
|
+
id?: string;
|
71
|
+
/** True if this notification was persisted to the database. */
|
72
|
+
persistent?: boolean;
|
73
|
+
/** ID of the sender, if a user. Otherwise 'null'. */
|
74
|
+
sender_id?: string;
|
75
|
+
/** Subject of the notification. */
|
76
|
+
subject?: string;
|
77
|
+
//
|
78
|
+
channel_id?: string;
|
79
|
+
//
|
80
|
+
clan_id?: string;
|
81
|
+
//
|
82
|
+
channel?: ApiChannelDescription;
|
83
|
+
}
|
84
|
+
|
61
85
|
/** A response from a channel join operation. */
|
62
86
|
export interface Channel {
|
63
87
|
/** The server-assigned channel id. */
|
@@ -1160,7 +1184,7 @@ export interface Socket {
|
|
1160
1184
|
onerror: (evt: Event) => void;
|
1161
1185
|
|
1162
1186
|
/** Receive notifications from the socket. */
|
1163
|
-
onnotification: (notification:
|
1187
|
+
onnotification: (notification: NotificationInfo) => void;
|
1164
1188
|
|
1165
1189
|
/** Receive status presence updates. */
|
1166
1190
|
onstatuspresence: (statusPresence: StatusPresenceEvent) => void;
|
@@ -1716,7 +1740,7 @@ export class DefaultSocket implements Socket {
|
|
1716
1740
|
}
|
1717
1741
|
}
|
1718
1742
|
|
1719
|
-
onnotification(notification:
|
1743
|
+
onnotification(notification: NotificationInfo) {
|
1720
1744
|
if (this.verbose && window && window.console) {
|
1721
1745
|
console.log(notification);
|
1722
1746
|
}
|