@fabriktor/fx 0.0.52 → 0.0.53

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.
@@ -136,7 +136,6 @@ export declare class ChatFX implements ChatFXOperator {
136
136
  reactUploadedChat(opts: ReactUploadedChatOptions): Promise<void>;
137
137
  private openChatRoomConnections;
138
138
  private openGlobalChatRoomsConnection;
139
- private allChatRoomMembers;
140
139
  private findUser;
141
140
  private findChat;
142
141
  }
@@ -119,7 +119,16 @@ export class ChatFX {
119
119
  const roomIDs = [
120
120
  ...new Set(opts.chat_room_ids.map((id) => id.trim())),
121
121
  ].filter((id) => id !== "");
122
- const entries = await Promise.all(roomIDs.map(async (chatRoomID) => [chatRoomID, await this.allChatRoomMembers(chatRoomID)]));
122
+ const result = await this.chat.queryChatRoomMembers({
123
+ query: {
124
+ chat_room_id: roomIDs,
125
+ },
126
+ });
127
+ const allMembers = result.value ?? [];
128
+ const entries = roomIDs.map((chatRoomID) => [
129
+ chatRoomID,
130
+ allMembers.filter((member) => member.chat_room_id === chatRoomID),
131
+ ]);
123
132
  const ownerIDs = [
124
133
  ...new Set(entries.flatMap(([, members]) => members.map((member) => member.owner_id))),
125
134
  ];
@@ -397,21 +406,6 @@ export class ChatFX {
397
406
  },
398
407
  };
399
408
  }
400
- async allChatRoomMembers(chatRoomID) {
401
- const out = [];
402
- let page = 1;
403
- for (;;) {
404
- const next = await this.searchChatRoomMembers({
405
- chat_room_id: chatRoomID,
406
- page,
407
- });
408
- out.push(...next.results);
409
- if (next.done) {
410
- return out;
411
- }
412
- page = next.next_page;
413
- }
414
- }
415
409
  async findUser(id) {
416
410
  const out = await this.users.findOneUser({ id });
417
411
  const user = out.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabriktor/fx",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "description": "![Fabriktor Logo](./img/fabriktor-character.gif)",
5
5
  "type": "module",
6
6
  "exports": {
@@ -17,7 +17,7 @@
17
17
  "typescript": "^6.0.3"
18
18
  },
19
19
  "dependencies": {
20
- "@fabriktor/client": "0.0.51",
20
+ "@fabriktor/client": "0.0.52",
21
21
  "@fabriktor/schema": "0.0.34"
22
22
  }
23
23
  }