polfan-server-js-client 0.2.98 → 0.2.100

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.
@@ -1,5 +1,7 @@
1
1
  import { Bye, GetSession, JoinSpace, Session, SpaceJoined, Error as ErrorType, SpaceLeft, SpaceMemberJoined, SpaceMemberLeft, SpaceMemberUpdated, SpaceDeleted, SpaceMembers, SpaceRooms, NewRole, RoomDeleted, RoomJoined, RoomLeft, RoomMemberLeft, RoomMemberJoined, RoomMembers, NewRoom, NewTopic, TopicDeleted, NewMessage, GetPermissionOverwrites, GetComputedPermissions, LeaveSpace, CreateSpace, DeleteSpace, GetSpaceMembers, GetSpaceRooms, CreateRole, DeleteRole, AssignRole, DeassignRole, SetPermissionOverwrites, JoinRoom, LeaveRoom, CreateRoom, DeleteRoom, GetRoomMembers, CreateTopic, DeleteTopic, CreateMessage, Envelope, PermissionOverwrites, PermissionOverwritesUpdated, RoomMemberUpdated, UpdateRole, RoleUpdated, Ack, UserUpdated, UpdateRoom, RoomUpdated, UpdateSpace, SpaceUpdated, PermissionOverwriteTargets, GetPermissionOverwriteTargets, Owners, Ok, GetOwners, CreateOwner, RoleDeleted, FollowedTopicUpdated, TopicFollowed, FollowedTopics, FollowTopic, UpdateFollowedTopic, GetFollowedTopics, Messages, GetMessages, Topics, GetTopics, TopicUpdated, UpdateTopic, GetDiscoverableSpaces, DiscoverableSpaces, CreateEmoticon, DeleteEmoticon, GetEmoticons, Emoticons, EmoticonDeleted, NewEmoticon, Bans, GetBans, Ban, Unban, Kick, ClientData, GetClientData, SetClientData, GetRoomSummary, GetSpaceSummary, RoomSummaryEvent, SpaceSummaryEvent, UpdateSpaceMember, Relationships, RelationshipDeleted, NewRelationship, DeleteRelationship, CreateRelationship, RoomSummaryUpdated, Pong, Ping, RedactMessages, MessagesRedacted, ReportAbuse, UpdateRoomMember, GetRelationships, GetUserInfo, UserInfo, SetSessionData } from "./types/src";
2
2
  import { EventTarget } from "./EventTarget";
3
+ import { SessionData } from "./types/src/schemes/SessionData";
4
+ import { GetSessionData } from "./types/src/schemes/commands/GetSessionData";
3
5
  type ArrayOfPromiseResolvers = [(value: any) => void, (reason?: any) => void];
4
6
  type ExtraEventMap = Record<string, any>;
5
7
  type CommandDefinition<RequestT, ResponseT> = {
@@ -39,6 +41,7 @@ export type EventsMap = {
39
41
  Emoticons: Emoticons;
40
42
  Bans: Bans;
41
43
  ClientData: ClientData;
44
+ SessionData: SessionData;
42
45
  NewRelationship: NewRelationship;
43
46
  RelationshipDeleted: RelationshipDeleted;
44
47
  Relationships: Relationships;
@@ -108,6 +111,7 @@ export type CommandsMap = {
108
111
  Ping: CommandDefinition<Ping, EventsMap['Pong']>;
109
112
  ReportAbuse: CommandDefinition<ReportAbuse, EventsMap['Ok']>;
110
113
  GetUserInfo: CommandDefinition<GetUserInfo, EventsMap['UserInfo']>;
114
+ GetSessionData: CommandDefinition<GetSessionData, EventsMap['SessionData']>;
111
115
  SetSessionData: CommandDefinition<SetSessionData, EventsMap['Ok']>;
112
116
  GetDiscoverableSpaces: CommandDefinition<GetDiscoverableSpaces, EventsMap['DiscoverableSpaces']>;
113
117
  JoinSpace: CommandDefinition<JoinSpace, EventsMap['SpaceJoined']>;
@@ -0,0 +1,4 @@
1
+ import { SessionPush } from "./commands/SetSessionData";
2
+ export interface SessionData {
3
+ push?: SessionPush;
4
+ }
@@ -0,0 +1,2 @@
1
+ export interface GetSessionData {
2
+ }
@@ -1,6 +1,7 @@
1
1
  export interface SessionPush {
2
- token: string;
3
- platform: 'ios' | 'android' | 'web';
2
+ token?: string;
3
+ platform?: 'ios' | 'android' | 'web';
4
+ active?: boolean;
4
5
  }
5
6
  export interface SetSessionData {
6
7
  clientFocused?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polfan-server-js-client",
3
- "version": "0.2.98",
3
+ "version": "0.2.100",
4
4
  "description": "JavaScript client library for handling communication with Polfan chat server.",
5
5
  "author": "Jarosław Żak",
6
6
  "license": "MIT",
@@ -112,6 +112,8 @@ import {
112
112
  UserInfo, SetSessionData,
113
113
  } from "./types/src";
114
114
  import {EventTarget} from "./EventTarget";
115
+ import {SessionData} from "./types/src/schemes/SessionData";
116
+ import {GetSessionData} from "./types/src/schemes/commands/GetSessionData";
115
117
 
116
118
  type ArrayOfPromiseResolvers = [(value: any) => void, (reason?: any) => void];
117
119
  type ExtraEventMap = Record<string, any>;
@@ -185,6 +187,7 @@ export type CommandResponse<CommandType extends keyof CommandsMap> = CommandsMap
185
187
  Emoticons: Emoticons,
186
188
  Bans: Bans,
187
189
  ClientData: ClientData,
190
+ SessionData: SessionData,
188
191
  NewRelationship: NewRelationship,
189
192
  RelationshipDeleted: RelationshipDeleted,
190
193
  Relationships: Relationships,
@@ -259,6 +262,7 @@ export type CommandsMap = {
259
262
  Ping: CommandDefinition<Ping, EventsMap['Pong']>,
260
263
  ReportAbuse: CommandDefinition<ReportAbuse, EventsMap['Ok']>,
261
264
  GetUserInfo: CommandDefinition<GetUserInfo, EventsMap['UserInfo']>,
265
+ GetSessionData: CommandDefinition<GetSessionData, EventsMap['SessionData']>,
262
266
  SetSessionData: CommandDefinition<SetSessionData, EventsMap['Ok']>,
263
267
  // Space commands
264
268
  GetDiscoverableSpaces: CommandDefinition<GetDiscoverableSpaces, EventsMap['DiscoverableSpaces']>,
@@ -321,7 +321,7 @@ export class FollowedTopicsManager extends EventTarget<EventMap> {
321
321
  } else if (ev.message.type === 'Text') {
322
322
  // ...check for mentions if it's text message...
323
323
  const member = await this.tracker.rooms.getMe(ev.message.location.roomId);
324
- const roleIds = [...(member.spaceMember?.roles ?? []), ...member.roles];
324
+ const roleIds = [...(member.spaceMember?.roles ?? []), ...(member.roles ?? [])];
325
325
  const mentionHandlers = [
326
326
  ...roleIds.map(id => `<@&${id}>`),
327
327
  `<@${me.id}>`,
@@ -0,0 +1,5 @@
1
+ import {SessionPush} from "./commands/SetSessionData";
2
+
3
+ export interface SessionData {
4
+ push?: SessionPush;
5
+ }
@@ -0,0 +1,3 @@
1
+ export interface GetSessionData {
2
+
3
+ }
@@ -1,6 +1,7 @@
1
1
  export interface SessionPush {
2
- token: string;
3
- platform: 'ios' | 'android' | 'web';
2
+ token?: string;
3
+ platform?: 'ios' | 'android' | 'web';
4
+ active?: boolean;
4
5
  }
5
6
 
6
7
  export interface SetSessionData {