polfan-server-js-client 0.4.2 → 0.4.3
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/.idea/shelf/Uncommitted_changes_before_Update_at_08_09_2026_17_04_[Changes]/shelved.patch +0 -0
- package/.idea/shelf/Uncommitted_changes_before_Update_at_08_09_2026_17_04__Changes_.xml +4 -0
- package/.idea/workspace.xml +36 -21
- package/build/index.cjs.js +20 -0
- package/build/index.cjs.js.map +1 -1
- package/build/index.umd.js +1 -1
- package/build/index.umd.js.map +1 -1
- package/build/types/Permissions.d.ts +4 -0
- package/build/types/index.d.ts +2 -2
- package/build/types/types/src/index.d.ts +3 -3
- package/build/types/types/src/schemes/Message.d.ts +10 -0
- package/build/types/types/src/schemes/Role.d.ts +14 -0
- package/build/types/types/src/schemes/commands/CreateRole.d.ts +1 -0
- package/build/types/types/src/schemes/commands/UpdateRole.d.ts +1 -0
- package/package.json +1 -1
- package/src/Permissions.ts +1 -0
- package/src/index.ts +2 -1
- package/src/types/src/index.ts +4 -2
- package/src/types/src/schemes/Message.ts +11 -0
- package/src/types/src/schemes/Role.ts +16 -1
- package/src/types/src/schemes/commands/CreateRole.ts +1 -0
- package/src/types/src/schemes/commands/UpdateRole.ts +1 -0
- package/tests/space-roles.test.ts +5 -5
|
@@ -98,6 +98,10 @@ export declare class Permissions {
|
|
|
98
98
|
value: number;
|
|
99
99
|
maxLayer: Layer;
|
|
100
100
|
};
|
|
101
|
+
MentionAllRoles: {
|
|
102
|
+
value: number;
|
|
103
|
+
maxLayer: Layer;
|
|
104
|
+
};
|
|
101
105
|
};
|
|
102
106
|
static getNames(): (keyof typeof this.list)[];
|
|
103
107
|
static getByName(name: keyof typeof this.list): PermissionDefinition | undefined;
|
package/build/types/index.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ import { IndexedCollection, IndexedObjectCollection, ObservableIndexedCollection
|
|
|
4
4
|
import { FilesClient, File } from "./FilesClient";
|
|
5
5
|
import { Permissions, PermissionDefinition, Layer } from "./Permissions";
|
|
6
6
|
import * as ChatTypes from './types/src';
|
|
7
|
-
import { UserStatus } from './types/src';
|
|
7
|
+
import { RoleFlag, UserStatus } from './types/src';
|
|
8
8
|
import { extractUserFromMember } from "./state-tracker/functions";
|
|
9
9
|
import { AbstractRestClient } from "./AbstractRestClient";
|
|
10
10
|
import { UnreadSummary } from "./state-tracker/FollowedTopicsManager";
|
|
11
|
-
export { IndexedCollection, ObservableIndexedCollection, IndexedObjectCollection, ObservableIndexedObjectCollection, Permissions, PermissionDefinition, Layer, WebSocketChatClient, WebApiChatClient, FilesClient, AbstractRestClient, extractUserFromMember, UserStatus, };
|
|
11
|
+
export { IndexedCollection, ObservableIndexedCollection, IndexedObjectCollection, ObservableIndexedObjectCollection, Permissions, PermissionDefinition, Layer, WebSocketChatClient, WebApiChatClient, FilesClient, AbstractRestClient, extractUserFromMember, UserStatus, RoleFlag, };
|
|
12
12
|
export type { ChatTypes, File, UnreadSummary, };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Envelope } from "./schemes/Envelope";
|
|
2
|
-
import { Message, MessageType, MessageAuthor } from "./schemes/Message";
|
|
2
|
+
import { Message, MessageType, MessageAuthor, MessageMentions } from "./schemes/Message";
|
|
3
3
|
import { PermissionOverwritesValue } from "./schemes/PermissionOverwritesValue";
|
|
4
|
-
import { Role } from "./schemes/Role";
|
|
4
|
+
import { Role, RoleFlag } from "./schemes/Role";
|
|
5
5
|
import { Room, RoomType } from "./schemes/Room";
|
|
6
6
|
import { RoomMember } from "./schemes/RoomMember";
|
|
7
7
|
import { RoomSummary, RoomSummaryExtras } from "./schemes/RoomSummary";
|
|
@@ -153,4 +153,4 @@ import { GetReactionDetails } from "./schemes/commands/GetReactionDetails";
|
|
|
153
153
|
import { ReactionUpdated } from "./schemes/events/ReactionUpdated";
|
|
154
154
|
import { Reacted } from "./schemes/events/Reacted";
|
|
155
155
|
import { ReactionDetails } from "./schemes/events/ReactionDetails";
|
|
156
|
-
export { Envelope, Message, MessageType, MessageAuthor, Role, Room, RoomType, RoomStream, RoomStreamType, RoomHistory, RoomHistoryMode, RoomMember, RoomSummary, RoomSummaryExtras, Space, SpaceMember, Topic, FollowedTopic, NotificationLevel, User, UserStatus, UserState, PermissionOverwritesValue, ChatLocation, SpaceSummary, SpaceDiscoverable, Emoticon, PermissionOverwritesTarget, BanObject, LeaveReason, UserRelationship, UserRelationshipType, CreateTopicInitialMessage, UserInformation, SessionPush, SessionData, SessionPlatform, UserData, PrivateMessagePolicy, ReactionType, MessageReaction, UserReaction, ToggledReaction, MessagePoll, MessagePollOption, Bye, Error, Messages, NewMessage, NewRole, NewRoom, NewTopic, TopicFollowed, TopicUnfollowed, FollowedTopics, FollowedTopicUpdated, ComputedPermissions, PermissionOverwrites, PermissionOverwritesUpdated, RoleDeleted, RoleUpdated, RoomDeleted, RoomUpdated, RoomJoined, RoomLeft, RoomMembersJoined, RoomMemberLeft, RoomMembers, RoomMemberUpdated, UserUpdated, Session, SpaceDeleted, SpaceUpdated, SpaceJoined, SpaceLeft, SpaceMemberJoined, SpaceMemberLeft, SpaceMembers, SpaceMemberUpdated, SpaceRooms, TopicDeleted, TopicUpdated, PermissionOverwriteTargets, Owners, Ok, DiscoverableSpaces, Emoticons, EmoticonDeleted, NewEmoticon, Bans, ClientData, SpaceSummaryEvent, RoomSummaryEvent, NewRelationship, RelationshipDeleted, Relationships, RoomSummaryUpdated, Pong, MessagesRedacted, UserInfo, Invited, ReactionUpdated, Reacted, ReactionDetails, AssignRole, GetMessages, CreateMessage, Ack, CreateRole, CreateRoom, CreateSpace, CreateTopic, FollowTopic, UnfollowTopic, UpdateFollowedTopic, GetFollowedTopics, DeassignRole, DeleteRole, DeleteRoom, DeleteSpace, DeleteTopic, SetPermissionOverwrites, GetPermissionOverwrites, GetComputedPermissions, GetRoomMembers, GetSession, GetSpaceMembers, GetSpaceRooms, JoinRoom, JoinSpace, LeaveRoom, LeaveSpace, UpdateRole, UpdateSpace, UpdateRoom, UpdateTopic, GetPermissionOverwriteTargets, CreateOwner, DeleteOwner, GetOwners, Topics, GetTopics, GetDiscoverableSpaces, GetEmoticons, CreateEmoticon, DeleteEmoticon, Ban, Unban, GetBans, Kick, GetClientData, SetClientData, GetSpaceSummary, GetRoomSummary, UpdateSpaceMember, CreateRelationship, DeleteRelationship, GetRelationships, UpdateRoomMember, Ping, ReportAbuse, RedactMessages, GetUserInfo, SetSessionData, GetSessionData, SetUserData, GetUserData, Invite, Uninvite, GetInvited, React, Unreact, GetReactionDetails, };
|
|
156
|
+
export { Envelope, Message, MessageType, MessageAuthor, MessageMentions, Role, RoleFlag, Room, RoomType, RoomStream, RoomStreamType, RoomHistory, RoomHistoryMode, RoomMember, RoomSummary, RoomSummaryExtras, Space, SpaceMember, Topic, FollowedTopic, NotificationLevel, User, UserStatus, UserState, PermissionOverwritesValue, ChatLocation, SpaceSummary, SpaceDiscoverable, Emoticon, PermissionOverwritesTarget, BanObject, LeaveReason, UserRelationship, UserRelationshipType, CreateTopicInitialMessage, UserInformation, SessionPush, SessionData, SessionPlatform, UserData, PrivateMessagePolicy, ReactionType, MessageReaction, UserReaction, ToggledReaction, MessagePoll, MessagePollOption, Bye, Error, Messages, NewMessage, NewRole, NewRoom, NewTopic, TopicFollowed, TopicUnfollowed, FollowedTopics, FollowedTopicUpdated, ComputedPermissions, PermissionOverwrites, PermissionOverwritesUpdated, RoleDeleted, RoleUpdated, RoomDeleted, RoomUpdated, RoomJoined, RoomLeft, RoomMembersJoined, RoomMemberLeft, RoomMembers, RoomMemberUpdated, UserUpdated, Session, SpaceDeleted, SpaceUpdated, SpaceJoined, SpaceLeft, SpaceMemberJoined, SpaceMemberLeft, SpaceMembers, SpaceMemberUpdated, SpaceRooms, TopicDeleted, TopicUpdated, PermissionOverwriteTargets, Owners, Ok, DiscoverableSpaces, Emoticons, EmoticonDeleted, NewEmoticon, Bans, ClientData, SpaceSummaryEvent, RoomSummaryEvent, NewRelationship, RelationshipDeleted, Relationships, RoomSummaryUpdated, Pong, MessagesRedacted, UserInfo, Invited, ReactionUpdated, Reacted, ReactionDetails, AssignRole, GetMessages, CreateMessage, Ack, CreateRole, CreateRoom, CreateSpace, CreateTopic, FollowTopic, UnfollowTopic, UpdateFollowedTopic, GetFollowedTopics, DeassignRole, DeleteRole, DeleteRoom, DeleteSpace, DeleteTopic, SetPermissionOverwrites, GetPermissionOverwrites, GetComputedPermissions, GetRoomMembers, GetSession, GetSpaceMembers, GetSpaceRooms, JoinRoom, JoinSpace, LeaveRoom, LeaveSpace, UpdateRole, UpdateSpace, UpdateRoom, UpdateTopic, GetPermissionOverwriteTargets, CreateOwner, DeleteOwner, GetOwners, Topics, GetTopics, GetDiscoverableSpaces, GetEmoticons, CreateEmoticon, DeleteEmoticon, Ban, Unban, GetBans, Kick, GetClientData, SetClientData, GetSpaceSummary, GetRoomSummary, UpdateSpaceMember, CreateRelationship, DeleteRelationship, GetRelationships, UpdateRoomMember, Ping, ReportAbuse, RedactMessages, GetUserInfo, SetSessionData, GetSessionData, SetUserData, GetUserData, Invite, Uninvite, GetInvited, React, Unreact, GetReactionDetails, };
|
|
@@ -3,6 +3,15 @@ import { ChatLocation } from "./ChatLocation";
|
|
|
3
3
|
import { MessageReaction } from "./Reaction";
|
|
4
4
|
import { MessagePoll } from "./MessagePoll";
|
|
5
5
|
export type MessageType = 'Text' | 'RoomJoin' | 'RoomMemberAdd' | 'RoomLeave' | 'SpaceJoin' | 'SpaceLeave' | 'TopicChange' | 'CustomNickChange' | 'Ephemeral' | 'Poll';
|
|
6
|
+
/**
|
|
7
|
+
* Mention targets a message actually reached, as resolved by the server: role
|
|
8
|
+
* mentions the author was not allowed to fire are absent, even though they stay
|
|
9
|
+
* in the content. Null when the message mentions nobody.
|
|
10
|
+
*/
|
|
11
|
+
export interface MessageMentions {
|
|
12
|
+
userIds: string[];
|
|
13
|
+
roleIds: string[];
|
|
14
|
+
}
|
|
6
15
|
export interface MessageAuthor {
|
|
7
16
|
user: User;
|
|
8
17
|
customNick?: string;
|
|
@@ -19,4 +28,5 @@ export interface Message {
|
|
|
19
28
|
attachments: string[] | null;
|
|
20
29
|
reactions: MessageReaction[];
|
|
21
30
|
poll?: MessagePoll;
|
|
31
|
+
mentions: MessageMentions | null;
|
|
22
32
|
}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bit flags of a role, stored in {@link Role.flags}.
|
|
3
|
+
*
|
|
4
|
+
* - `SeparateOnMembersList` - available holders of the role are listed in their
|
|
5
|
+
* own group of the members list, headed by the role name.
|
|
6
|
+
* - `MentionableByEveryone` - anybody may mention the role with notification
|
|
7
|
+
* effects; without it the mention is decorative only, unless the author holds
|
|
8
|
+
* the `MentionAllRoles` permission.
|
|
9
|
+
*/
|
|
10
|
+
export declare enum RoleFlag {
|
|
11
|
+
SeparateOnMembersList = 1,
|
|
12
|
+
MentionableByEveryone = 2
|
|
13
|
+
}
|
|
1
14
|
export interface Role {
|
|
2
15
|
id: string;
|
|
3
16
|
priority: number;
|
|
4
17
|
name: string;
|
|
5
18
|
color?: string;
|
|
19
|
+
flags: number;
|
|
6
20
|
}
|
package/package.json
CHANGED
package/src/Permissions.ts
CHANGED
|
@@ -35,6 +35,7 @@ export class Permissions {
|
|
|
35
35
|
AddMembers: {value: 1 << 20, maxLayer: Layer.Space},
|
|
36
36
|
React: {value: 1 << 21, maxLayer: Layer.Topic},
|
|
37
37
|
CreatePolls: {value: 1 << 22, maxLayer: Layer.Topic},
|
|
38
|
+
MentionAllRoles: {value: 1 << 23, maxLayer: Layer.Topic},
|
|
38
39
|
};
|
|
39
40
|
|
|
40
41
|
public static getNames(): (keyof typeof this.list)[] {
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {FilesClient, File} from "./FilesClient";
|
|
10
10
|
import { Permissions, PermissionDefinition, Layer } from "./Permissions";
|
|
11
11
|
import * as ChatTypes from './types/src';
|
|
12
|
-
import {UserStatus} from './types/src';
|
|
12
|
+
import {RoleFlag, UserStatus} from './types/src';
|
|
13
13
|
import {extractUserFromMember} from "./state-tracker/functions";
|
|
14
14
|
import {AbstractRestClient} from "./AbstractRestClient";
|
|
15
15
|
import {UnreadSummary} from "./state-tracker/FollowedTopicsManager";
|
|
@@ -23,6 +23,7 @@ export {
|
|
|
23
23
|
AbstractRestClient,
|
|
24
24
|
extractUserFromMember,
|
|
25
25
|
UserStatus,
|
|
26
|
+
RoleFlag,
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
export type {
|
package/src/types/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Envelope} from "./schemes/Envelope";
|
|
2
|
-
import {Message, MessageType, MessageAuthor} from "./schemes/Message";
|
|
2
|
+
import {Message, MessageType, MessageAuthor, MessageMentions} from "./schemes/Message";
|
|
3
3
|
import {PermissionOverwritesValue} from "./schemes/PermissionOverwritesValue";
|
|
4
|
-
import {Role} from "./schemes/Role";
|
|
4
|
+
import {Role, RoleFlag} from "./schemes/Role";
|
|
5
5
|
import {Room, RoomType} from "./schemes/Room";
|
|
6
6
|
import {RoomMember} from "./schemes/RoomMember";
|
|
7
7
|
import {RoomSummary, RoomSummaryExtras} from "./schemes/RoomSummary";
|
|
@@ -160,7 +160,9 @@ export {
|
|
|
160
160
|
Message,
|
|
161
161
|
MessageType,
|
|
162
162
|
MessageAuthor,
|
|
163
|
+
MessageMentions,
|
|
163
164
|
Role,
|
|
165
|
+
RoleFlag,
|
|
164
166
|
Room,
|
|
165
167
|
RoomType,
|
|
166
168
|
RoomStream,
|
|
@@ -5,6 +5,16 @@ import {MessagePoll} from "./MessagePoll";
|
|
|
5
5
|
|
|
6
6
|
export type MessageType = 'Text'|'RoomJoin'|'RoomMemberAdd'|'RoomLeave'|'SpaceJoin'|'SpaceLeave'|'TopicChange'|'CustomNickChange'|'Ephemeral'|'Poll';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Mention targets a message actually reached, as resolved by the server: role
|
|
10
|
+
* mentions the author was not allowed to fire are absent, even though they stay
|
|
11
|
+
* in the content. Null when the message mentions nobody.
|
|
12
|
+
*/
|
|
13
|
+
export interface MessageMentions {
|
|
14
|
+
userIds: string[];
|
|
15
|
+
roleIds: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
8
18
|
export interface MessageAuthor {
|
|
9
19
|
user: User;
|
|
10
20
|
customNick?: string;
|
|
@@ -22,4 +32,5 @@ export interface Message {
|
|
|
22
32
|
attachments: string[] | null;
|
|
23
33
|
reactions: MessageReaction[];
|
|
24
34
|
poll?: MessagePoll;
|
|
35
|
+
mentions: MessageMentions | null;
|
|
25
36
|
}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bit flags of a role, stored in {@link Role.flags}.
|
|
3
|
+
*
|
|
4
|
+
* - `SeparateOnMembersList` - available holders of the role are listed in their
|
|
5
|
+
* own group of the members list, headed by the role name.
|
|
6
|
+
* - `MentionableByEveryone` - anybody may mention the role with notification
|
|
7
|
+
* effects; without it the mention is decorative only, unless the author holds
|
|
8
|
+
* the `MentionAllRoles` permission.
|
|
9
|
+
*/
|
|
10
|
+
export enum RoleFlag {
|
|
11
|
+
SeparateOnMembersList = 1 << 0,
|
|
12
|
+
MentionableByEveryone = 1 << 1,
|
|
13
|
+
}
|
|
14
|
+
|
|
1
15
|
export interface Role {
|
|
2
16
|
id: string;
|
|
3
17
|
priority: number;
|
|
4
18
|
name: string;
|
|
5
19
|
color?: string;
|
|
6
|
-
|
|
20
|
+
flags: number;
|
|
21
|
+
}
|
|
@@ -5,11 +5,11 @@ import {reorderRolesOnPriorityUpdate} from "../src/state-tracker/functions";
|
|
|
5
5
|
const createCollection = () => new IndexedObjectCollection<Role>(
|
|
6
6
|
role => role.id,
|
|
7
7
|
[
|
|
8
|
-
{id: 'id1', name: 'everyone', priority: 0, color: '#ff0000'},
|
|
9
|
-
{id: 'id2', name: 'roleA', priority: 1, color: '#ff0000'},
|
|
10
|
-
{id: 'id3', name: 'roleB', priority: 2, color: '#ff0000'},
|
|
11
|
-
{id: 'id4', name: 'roleC', priority: 3, color: '#ff0000'},
|
|
12
|
-
{id: 'id5', name: 'roleD', priority: 4, color: '#ff0000'},
|
|
8
|
+
{id: 'id1', name: 'everyone', priority: 0, color: '#ff0000', flags: 0},
|
|
9
|
+
{id: 'id2', name: 'roleA', priority: 1, color: '#ff0000', flags: 0},
|
|
10
|
+
{id: 'id3', name: 'roleB', priority: 2, color: '#ff0000', flags: 0},
|
|
11
|
+
{id: 'id4', name: 'roleC', priority: 3, color: '#ff0000', flags: 0},
|
|
12
|
+
{id: 'id5', name: 'roleD', priority: 4, color: '#ff0000', flags: 0},
|
|
13
13
|
],
|
|
14
14
|
);
|
|
15
15
|
|