polfan-server-js-client 0.2.97 → 0.2.98

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.
@@ -15,14 +15,14 @@ export declare class FollowedTopicsManager extends EventTarget<EventMap> {
15
15
  /**
16
16
  * Cache followed topics for all joined rooms in a space and fetch them in bulk if necessary.
17
17
  * Then you can get them using getRoomFollowedTopics().
18
- * @see getRoomFollowedTopics
18
+ * @see getForRoom
19
19
  */
20
- cacheSpaceFollowedTopics(spaceId: string | null): Promise<void>;
20
+ cacheForSpace(spaceId: string | null): Promise<void>;
21
21
  /**
22
22
  * Get followed topics for the given room.
23
23
  * @return Undefined if you are not in the room, collection otherwise.
24
24
  */
25
- getRoomFollowedTopics(roomId: string): Promise<ObservableIndexedObjectCollection<FollowedTopic> | undefined>;
25
+ getForRoom(roomId: string): Promise<ObservableIndexedObjectCollection<FollowedTopic> | undefined>;
26
26
  /**
27
27
  * Batch acknowledge all messages for given room.
28
28
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polfan-server-js-client",
3
- "version": "0.2.97",
3
+ "version": "0.2.98",
4
4
  "description": "JavaScript client library for handling communication with Polfan chat server.",
5
5
  "author": "Jarosław Żak",
6
6
  "license": "MIT",
@@ -40,9 +40,9 @@ export class FollowedTopicsManager extends EventTarget<EventMap> {
40
40
  /**
41
41
  * Cache followed topics for all joined rooms in a space and fetch them in bulk if necessary.
42
42
  * Then you can get them using getRoomFollowedTopics().
43
- * @see getRoomFollowedTopics
43
+ * @see getForRoom
44
44
  */
45
- public async cacheSpaceFollowedTopics(spaceId: string | null): Promise<void> {
45
+ public async cacheForSpace(spaceId: string | null): Promise<void> {
46
46
  if (spaceId && ! (await this.tracker.spaces.get()).has(spaceId)) {
47
47
  throw new Error(`You are not in space ${spaceId}`);
48
48
  }
@@ -79,7 +79,7 @@ export class FollowedTopicsManager extends EventTarget<EventMap> {
79
79
  * Get followed topics for the given room.
80
80
  * @return Undefined if you are not in the room, collection otherwise.
81
81
  */
82
- public async getRoomFollowedTopics(roomId: string): Promise<ObservableIndexedObjectCollection<FollowedTopic> | undefined> {
82
+ public async getForRoom(roomId: string): Promise<ObservableIndexedObjectCollection<FollowedTopic> | undefined> {
83
83
  if (! (await this.tracker.rooms.get()).has(roomId)) {
84
84
  return undefined;
85
85
  }
@@ -107,7 +107,7 @@ export class FollowedTopicsManager extends EventTarget<EventMap> {
107
107
  * Batch acknowledge all messages for given room.
108
108
  */
109
109
  public async ackRoom(roomId: string): Promise<void> {
110
- const collection = await this.getRoomFollowedTopics(roomId);
110
+ const collection = await this.getForRoom(roomId);
111
111
 
112
112
  if (! collection) {
113
113
  return;
@@ -152,10 +152,10 @@ export class FollowedTopicsManager extends EventTarget<EventMap> {
152
152
  } else if (location.roomId) {
153
153
  roomIds = [location.roomId];
154
154
  } else if (location.spaceId) {
155
- await this.cacheSpaceFollowedTopics(location.spaceId);
155
+ await this.cacheForSpace(location.spaceId);
156
156
  roomIds = rooms.findBy('spaceId', location.spaceId).items.map(r => r.id);
157
157
  } else {
158
- await this.cacheSpaceFollowedTopics(null);
158
+ await this.cacheForSpace(null);
159
159
  roomIds = rooms.items.filter(r => !r.spaceId).map(r => r.id);
160
160
  }
161
161
 
@@ -163,7 +163,7 @@ export class FollowedTopicsManager extends EventTarget<EventMap> {
163
163
  let isUnread = false;
164
164
 
165
165
  for (const roomId of roomIds) {
166
- const collection = await this.getRoomFollowedTopics(roomId);
166
+ const collection = await this.getForRoom(roomId);
167
167
 
168
168
  if (!collection) {
169
169
  continue;